dimanche 26 février 2017

Retrofit 2 Calls Override

All the examples that i have seen online about retrofit 2 include an interface which has the different urls to make the call to.

I have done the same in the form of.

@GET("NewsFeed/latest")
Observable<ArrayList<News>> getNews(@Query("category") int category,
                                    @Query("language") int language,
                                    @Query("location") int location,
                                    @Query("poster") int poster,
                                    @Query("limit") int limit,
                                    @Query("offset") long offset);

All the parameters in that call are optional so the call can be made even if none of the parameters are specified.Is there a way i can do that other than overloading the method? Should i use the @nullable annotation?

Aucun commentaire:

Enregistrer un commentaire