Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Last active November 29, 2020 01:13
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 chelseatroy/812c8f8cb48be24bb7e8a21ab4a16bbb to your computer and use it in GitHub Desktop.
Save chelseatroy/812c8f8cb48be24bb7e8a21ab4a16bbb to your computer and use it in GitHub Desktop.
Implementing the API
package com.chelseatroy.canary.api
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
class MockyAPIImplementation {
private val service: LoginService
companion object {
const val BASE_URL = "http://www.mocky.io/"
}
init {
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
service = retrofit.create(LoginService::class.java)
}
suspend fun authenticate(): CanarySession {
return service.authenticate()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment