Last active
January 9, 2019 18:26
-
-
Save naturalwarren/9ed4414e7b8e466f7d2601d28c0e96ce to your computer and use it in GitHub Desktop.
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
/** | |
* A response from the Coinbase API. | |
* | |
* In the event that a 2xx is returned [isSuccessful] will be set to true | |
* and [body] will be set. | |
* In the event that a non-2xx response is returned [isSuccessful] will be | |
* set to false and [errorBody] will be set. | |
* In the event that a request did not result in a response from the monorail | |
* [networkError] will be set. | |
*/ | |
class CoinbaseResponse<T : Any, U : Any>( | |
response: Response<T>?, | |
val errorBody: U?, | |
val networkError: IOException? | |
) { | |
val body: T? = response?.body() | |
val isSuccessful = response?.isSuccessful ?: false | |
val code: Int? = response?.code() | |
} | |
interface OAuthApi { | |
@POST("token") | |
fun authToken(@Body body: TokenRequestBody): | |
Single<CoinbaseResponse<AccessToken, OAuthError>> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment