ApiPedidos.kt 793 Bytes
Newer Older
1
package com.example.ayudapy.api
2 3 4 5 6 7 8 9 10 11

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

interface ApiPedidos {


    companion object{
12
        val instance: ApiService by lazy{
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

            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)
        }
    }
}