Last active
November 29, 2020 01:13
-
-
Save chelseatroy/812c8f8cb48be24bb7e8a21ab4a16bbb to your computer and use it in GitHub Desktop.
Implementing the API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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