Skip to content

Instantly share code, notes, and snippets.

@mikepyts
Created April 13, 2019 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikepyts/f3f9366e23731627e7920976ab328125 to your computer and use it in GitHub Desktop.
Save mikepyts/f3f9366e23731627e7920976ab328125 to your computer and use it in GitHub Desktop.
Shows set up of Retrofit interface
// Retrofit interface
interface GCPService {
@GET("/bigquery/v2/projects/weather-231121/datasets/WeatherDataSet/tables/WeatherDataTable/data")
fun getTable(@Header("Authorization") token: String, @Query("startIndex") startIndex: Int): Call<JsonObject>
}
// Retrofit builder
private val retrofitBuilder = Retrofit.Builder()
.baseUrl("https://content.googleapis.com")
.addConverterFactory(GsonConverterFactory.create())
.build()
// Create service
private val gcpService = retrofitBuilder.create(BigQueryAPI.GCPService::class.java)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment