ApiPedidos.kt 864 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
package com.example.ayudapy

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query

interface ApiPedidos {


    companion object{
        val instance:ApiService by lazy{

            val builder_pedido = Retrofit.Builder()
                .baseUrl("https://ayudapy.org/api/v1/helprequestsgeo/")
                .addConverterFactory(GsonConverterFactory.create())

            val client = OkHttpClient.Builder()

            client.addInterceptor(HttpLoggingInterceptor().apply {
                level = HttpLoggingInterceptor.Level.BODY
            })

            builder_pedido.client(client.build())
            builder_pedido.build().create(ApiService::class.java)
        }
    }
}