1
在爲「/1.1/lists/create.json」執行POST時指定回調的正確方法是什麼?TwitterApiClient:什麼是POST的回調簽名?
這裏是Twitter的API文檔:https://dev.twitter.com/rest/reference/post/lists/create
MyTwitterApiClient
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.TwitterApiClient;
import com.twitter.sdk.android.core.TwitterSession;
import com.twitter.sdk.android.core.models.User;
import retrofit.http.Field;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Query;
class MyTwitterApiClient extends TwitterApiClient {
public MyTwitterApiClient(TwitterSession session) {
super(session);
}
public CustomService getCustomService() {
return getService(CustomService.class);
}
}
interface CustomService {
@GET("/1.1/users/show.json")
void show(@Query("user_id") long id, Callback<User> cb);
@POST("/1.1/lists/create.json")
// I was incorrectly using @Field instead of @Query, be careful!
void createList(@Query("name") String name, @Query("mode") String mode, Callback cb);
}