Maybe fixed issue with marking items.

This commit is contained in:
Amine 2017-10-29 20:10:02 +01:00
parent 803e8cb2f4
commit 5721506007

View File

@ -1,21 +1,16 @@
package apps.amine.bou.readerforselfoss.api.selfoss package apps.amine.bou.readerforselfoss.api.selfoss
import retrofit2.Call import retrofit2.Call
import retrofit2.http.DELETE import retrofit2.http.*
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
// codebeat:disable[ARITY] // codebeat:disable[ARITY]
internal interface SelfossService { internal interface SelfossService {
@GET("login") @GET("login")
fun loginToSelfoss(@Query("username") username: String, @Query("password") password: String): Call<SuccessResponse> fun loginToSelfoss(@Query("username") username: String, @Query("password") password: String): Call<SuccessResponse>
@GET("items") @GET("items")
fun getItems(@Query("type") type: String, fun getItems(@Query("type") type: String,
@Query("tag") tag: String?, @Query("tag") tag: String?,
@ -26,17 +21,21 @@ internal interface SelfossService {
@Query("items") items: Int, @Query("items") items: Int,
@Query("offset") offset: Int): Call<List<Item>> @Query("offset") offset: Int): Call<List<Item>>
@Headers("Content-Type: application/json")
@POST("mark/{id}") @POST("mark/{id}")
fun markAsRead(@Path("id") id: String, fun markAsRead(@Path("id") id: String,
@Query("username") username: String, @Query("username") username: String,
@Query("password") password: String): Call<SuccessResponse> @Query("password") password: String): Call<SuccessResponse>
@Headers("Content-Type: application/json")
@POST("unmark/{id}") @POST("unmark/{id}")
fun unmarkAsRead(@Path("id") id: String, fun unmarkAsRead(@Path("id") id: String,
@Query("username") username: String, @Query("username") username: String,
@Query("password") password: String): Call<SuccessResponse> @Query("password") password: String): Call<SuccessResponse>
@FormUrlEncoded @FormUrlEncoded
@POST("mark") @POST("mark")
fun markAllAsRead(@Field("ids[]") ids: List<String>, fun markAllAsRead(@Field("ids[]") ids: List<String>,
@ -44,12 +43,14 @@ internal interface SelfossService {
@Query("password") password: String): Call<SuccessResponse> @Query("password") password: String): Call<SuccessResponse>
@Headers("Content-Type: application/json")
@POST("starr/{id}") @POST("starr/{id}")
fun starr(@Path("id") id: String, fun starr(@Path("id") id: String,
@Query("username") username: String, @Query("username") username: String,
@Query("password") password: String): Call<SuccessResponse> @Query("password") password: String): Call<SuccessResponse>
@Headers("Content-Type: application/json")
@POST("unstarr/{id}") @POST("unstarr/{id}")
fun unstarr(@Path("id") id: String, fun unstarr(@Path("id") id: String,
@Query("username") username: String, @Query("username") username: String,
@ -70,10 +71,12 @@ internal interface SelfossService {
fun update(@Query("username") username: String, fun update(@Query("username") username: String,
@Query("password") password: String): Call<String> @Query("password") password: String): Call<String>
@GET("sources/spouts") @GET("sources/spouts")
fun spouts(@Query("username") username: String, fun spouts(@Query("username") username: String,
@Query("password") password: String): Call<Map<String, Spout>> @Query("password") password: String): Call<Map<String, Spout>>
@GET("sources/list") @GET("sources/list")
fun sources(@Query("username") username: String, fun sources(@Query("username") username: String,
@Query("password") password: String): Call<List<Sources>> @Query("password") password: String): Call<List<Sources>>
@ -84,6 +87,7 @@ internal interface SelfossService {
@Query("username") username: String, @Query("username") username: String,
@Query("password") password: String): Call<SuccessResponse> @Query("password") password: String): Call<SuccessResponse>
@FormUrlEncoded @FormUrlEncoded
@POST("source") @POST("source")
fun createSource(@Field("title") title: String, fun createSource(@Field("title") title: String,