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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class BasicTilequery {
public static void main(String[] args) {
MapboxTilequery tilequery = MapboxTilequery.builder()
.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.query(Point.fromLngLat(-122.42901, 37.806332))
.radius(500)
.limit(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected GsonBuilder getGsonBuilder() {
@Override
protected Call<FeatureCollection> initializeCall() {
return getService().getCall(
mapIds(),
tilesetIds(),
query(),
accessToken(),
radius(),
Expand All @@ -69,7 +69,7 @@ private Call<List<FeatureCollection>> getBatchCall() {
}

batchCall = getService().getBatchCall(
mapIds(),
tilesetIds(),
query(),
accessToken(),
radius(),
Expand Down Expand Up @@ -145,7 +145,7 @@ public static Builder builder() {
abstract String accessToken();

@NonNull
abstract String mapIds();
abstract String tilesetIds();

@NonNull
abstract String query();
Expand All @@ -167,7 +167,7 @@ public static Builder builder() {

/**
* This builder is used to create a new request to the Mapbox Tilequery API. At a bare minimum,
* your request must include an access token, a map ID, and a query of some kind. All other
* your request must include an access token, a tileset ID, and a query of some kind. All other
* fields can be left alone in order to use the default behaviour of the API.
* <p>
* Note to contributors: All optional booleans in this builder use the object {@code Boolean}
Expand Down Expand Up @@ -198,14 +198,14 @@ public abstract static class Builder {
public abstract Builder accessToken(@NonNull String accessToken);

/**
* The ID of the map being queried. If you need to composite multiple layers, the Tilequery
* API endpoint can also support a comma-separated list of map IDs.
* The ID of the tileset being queried. If you need to composite multiple layers, the Tilequery
* API endpoint can also support a comma-separated list of tileset IDs.
*
* @param mapIds Map ID(s)
* @param tilesetIds tile set ID(s)
* @return this builder for chaining options together
* @since 3.5.0
*/
public abstract Builder mapIds(String mapIds);
public abstract Builder tilesetIds(String tilesetIds);

/**
* The longitude and latitude to be queried.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface TilequeryService {
/**
* Constructs the HTTP request for the specified parameters.
*
* @param mapIds Map ID(s)
* @param tilesetIds tile set ID(s)
* @param query query point
* @param accessToken Mapbox access token
* @param radius distance in meters to query for features
Expand All @@ -30,9 +30,9 @@ public interface TilequeryService {
* @return A retrofit Call object
* @since 3.5.0
*/
@GET("/v4/{mapIds}/tilequery/{query}.json")
@GET("/v4/{tilesetIds}/tilequery/{query}.json")
Call<FeatureCollection> getCall(
@Path("mapIds") String mapIds,
@Path("tilesetIds") String tilesetIds,
@Path("query") String query,
@Query("access_token") String accessToken,
@Query("radius") Integer radius,
Expand All @@ -44,7 +44,7 @@ Call<FeatureCollection> getCall(
/**
* Constructs the HTTP request for the specified parameters.
*
* @param mapIds Map ID(s)
* @param tilesetIds tile set ID(s)
* @param query query point
* @param accessToken Mapbox access token
* @param radius distance in meters to query for features
Expand All @@ -55,9 +55,9 @@ Call<FeatureCollection> getCall(
* @return A retrofit Call object
* @since 3.5.0
*/
@GET("/v4/{mapIds}/tilequery/{query}.json")
@GET("/v4/{tilesetIds}/tilequery/{query}.json")
Call<List<FeatureCollection>> getBatchCall(
@Path("mapIds") String mapIds,
@Path("tilesetIds") String tilesetIds,
@Path("query") String query,
@Query("access_token") String accessToken,
@Query("radius") Integer radius,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void sanity() throws ServicesException, IOException {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();
Response<FeatureCollection> response = client.executeCall();
Expand All @@ -40,7 +40,7 @@ public void query_acceptsPointsCorrectly() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query(Point.fromLngLat(-122.42901,37.80633))
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();

Expand All @@ -56,7 +56,7 @@ public void build_noAccessTokenExceptionThrown() throws Exception {
thrown.expectMessage("Missing required properties: accessToken");
MapboxTilequery.builder()
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();
}
Expand All @@ -68,7 +68,7 @@ public void build_invalidAccessTokenExceptionThrown() throws ServicesException {
MapboxTilequery.builder()
.accessToken("")
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();
}
Expand All @@ -79,7 +79,7 @@ public void build_noQueryExceptionThrown() throws Exception {
thrown.expectMessage("Missing required properties: query");
MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();
}
Expand All @@ -91,15 +91,15 @@ public void build_invalidQueryExceptionThrown() throws ServicesException {
MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();
}

@Test
public void build_noMapIdExceptionThrown() throws Exception {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Missing required properties: mapIds");
thrown.expectMessage("Missing required properties: tilesetIds");
MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
Expand All @@ -112,7 +112,7 @@ public void build_optionalParameters() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.build();

Expand All @@ -132,7 +132,7 @@ public void build_limitGetsAddedToListCorrectly() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.limit(50)
.build();
Expand All @@ -145,7 +145,7 @@ public void build_radiusGetsAddedToListCorrectly() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.radius(200)
.build();
Expand All @@ -158,7 +158,7 @@ public void build_geometryGetsAddedToListCorrectly() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.geometry(TilequeryCriteria.TILEQUERY_GEOMETRY_LINESTRING)
.build();
Expand All @@ -172,7 +172,7 @@ public void build_dedupeGetsAddedToListCorrectly() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.dedupe(true)
.build();
Expand All @@ -186,7 +186,7 @@ public void build_layersGetAddedToListCorrectly() throws Exception {
MapboxTilequery client = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.layers("poi_label")
.build();
Expand All @@ -199,7 +199,7 @@ public void executeCall_optionalParamLimitHonored() throws Exception {
MapboxTilequery clientAppParams = MapboxTilequery.builder()
.accessToken(ACCESS_TOKEN)
.query("-122.42901,37.80633")
.mapIds("mapbox.mapbox-streets-v7")
.tilesetIds("mapbox.mapbox-streets-v7")
.baseUrl(mockUrl.toString())
.layers("poi_label")
.geometry("point")
Expand Down