Android 改造 ParseSdk Geopoint
Android Retrofit ParseSdk Geopoint
我在解析数据库中有一些位置数据。
我想使用改造来找到给定纬度和经度的壁橱
下面是 link 和 curl 请求。
https://parse.com/docs/rest/guide#geopoints-geo-queries
curl -X GET \
-H "X-Parse-Application-Id: xxxxxx" \
-H "X-Parse-REST-API-Key: xxxxx" \
-G \
--data-urlencode 'limit=10' \
--data-urlencode 'where={
"location": {
"$nearSphere": {
"__type": "GeoPoint",
"latitude": 30.0,
"longitude": -20.0
}
}
}' \
如何将上面的 curl 转换为改造调用?
我想我必须在某处使用 QueryMap,但不知道在哪里。
这是我目前所拥有的。
@GET("/classes/Place")
void getPlaces(@Query("limit") Integer limit,
Callback<PlacesResult> callback);
这是使用 headers "X-Parse-Application-Id: xxxxxx"
、"X-Parse-REST-API-Key: xxxxx"
和格式 url 编码的 body 和 @Query("where")
占用字符串的请求。
您可以将这些 headers 放入所有请求的 http 调用 Interceptor
中。
是的,这可以用 QueryMap
来完成,它将有两个查询参数。
我在解析数据库中有一些位置数据。 我想使用改造来找到给定纬度和经度的壁橱 下面是 link 和 curl 请求。
https://parse.com/docs/rest/guide#geopoints-geo-queries
curl -X GET \
-H "X-Parse-Application-Id: xxxxxx" \
-H "X-Parse-REST-API-Key: xxxxx" \
-G \
--data-urlencode 'limit=10' \
--data-urlencode 'where={
"location": {
"$nearSphere": {
"__type": "GeoPoint",
"latitude": 30.0,
"longitude": -20.0
}
}
}' \
如何将上面的 curl 转换为改造调用? 我想我必须在某处使用 QueryMap,但不知道在哪里。 这是我目前所拥有的。
@GET("/classes/Place")
void getPlaces(@Query("limit") Integer limit,
Callback<PlacesResult> callback);
这是使用 headers "X-Parse-Application-Id: xxxxxx"
、"X-Parse-REST-API-Key: xxxxx"
和格式 url 编码的 body 和 @Query("where")
占用字符串的请求。
您可以将这些 headers 放入所有请求的 http 调用 Interceptor
中。
是的,这可以用 QueryMap
来完成,它将有两个查询参数。