Açıklama Yok

RestApi.kt 1.5KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.example.floradex20.interfaces
  2. import com.example.floradex20.models.PlantListss
  3. import com.example.floradex20.models.UserInfo
  4. import retrofit2.Call
  5. import retrofit2.http.*
  6. interface RestApi {
  7. @Headers("Content-Type: application/json")
  8. @POST("~victor.hernandez17/flowerdex/signup.php")
  9. fun addUser(@Body userData: UserInfo): Call<UserInfo>
  10. @Headers("Content-Type: application/json")
  11. @POST("~victor.hernandez17/flowerdex/login.php")
  12. fun logInUser(@Body UserData: UserInfo): Call<UserInfo>
  13. @GET("~victor.hernandez17/flowerdex/listFlowers.php") // /api/v1/plants/
  14. //Quite el id de la planta para recibir mas cosas
  15. //Posiblemente se puede overload la funcion para q funcione sin id y con id
  16. fun getPlants(@Query("user_id") user_id: String): Call<PlantListss>
  17. //El Api Query que se usa cuando se hace un search
  18. @GET("~victor.hernandez17/flowerdex/listFlowers.php") // /api/v1/plants/search/
  19. fun getPlantsbyName(@Query("user_id") user_id: String,
  20. @Query("q") q: String): Call<PlantListss>
  21. //Api query para el filter
  22. @GET("~victor.hernandez17/flowerdex/listFlowers.php") // api/v1/plants/
  23. fun getFiltered(@Query("user_id") user_id: String,
  24. @Query("edible") edible: String,
  25. @Query("vegetable") vegetable: String,
  26. @Query("flower_color") color: String,
  27. @Query("scientific_name") scientificName: String): Call<PlantListss>
  28. }