Last active
December 2, 2018 21:17
-
-
Save naturalwarren/90b93fe52963f5b36e3f7ffbbaffa01b to your computer and use it in GitHub Desktop.
Custom response class CoinbaseResponse.
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 class that holds a success and error body type as well | |
* as a throwable for network errors. | |
* | |
* @param T success response body type. | |
* @param U error response body type. | |
* @param body set when a call succeeds with a 2xx status code. | |
* @param errorBody set when a call fails with a non-2xx calls status code. | |
* @param networkError set when a network error occurs. | |
*/ | |
data class CoinbaseResponse<T : Any, U : Any>( | |
val body: T?, | |
val errorBody: U?, | |
val networkError: IOException?) | |
/** | |
* Sample service that returns a stream of [CoinbaseResponse]. | |
*/ | |
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