我最终解决了这个问题,使用自定义服务和客户端进行搜索以获取 JSON 响应,而不是使用改造的映射。
例如,对于搜索服务,
interface CustomSearchService {
@GET("/1.1/search/tweets.json")
void tweets(@Query("q") String var1, @EncodedQuery("geocode") Geocode var2, @Query("lang") String var3, @Query("locale") String var4, @Query("result_type") String var5, @Query("count") Integer var6, @Query("until") String var7, @Query("since_id") Long var8, @Query("max_id") Long var9, @Query("include_entities") Boolean var10, Callback<Response> var11);
}
static class SearchApiClient extends TwitterApiClient {
public SearchApiClient(Session session) {
super(session);
}
public CustomSearchService getCustomSearchService() {
return getService(CustomSearchService.class);
}
}
并通过获取数据,
apiClient.getCustomSearchService().tweets(searchParam.toString(), null, null, null, null, TWEET_COUNT, null,null, null, true,
new Callback<Response>() {
@Override
public void success(Result<Response> result) {
//DO SOMETHING WITH THE JSON RESPONSE HERE
// InputStream stream = result.data.getBody().in(); //<-- This contains the data
}
}