parent
f874d363aa
commit
2c6f66eabd
@ -0,0 +1,22 @@
|
|||||||
|
package com.example.veraxapplication.modele
|
||||||
|
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
|
||||||
|
object RetrofitClient {
|
||||||
|
|
||||||
|
private const val BASE_URL = "http://181.214.189.133:9092/"
|
||||||
|
|
||||||
|
val retrofit: Retrofit by lazy {
|
||||||
|
Retrofit.Builder()
|
||||||
|
.baseUrl(BASE_URL)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object ApiClient {
|
||||||
|
val apiService: ApiService by lazy {
|
||||||
|
RetrofitClient.retrofit.create(ApiService::class.java)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.veraxapplication.modele
|
||||||
|
|
||||||
|
import com.example.veraxapplication.modele.articles.Article
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.http.GET
|
||||||
|
|
||||||
|
interface ApiService {
|
||||||
|
@GET("articles/")
|
||||||
|
fun getArticles(): Call<List<Article>>
|
||||||
|
}
|
Loading…
Reference in new issue