Created
February 20, 2019 14:49
-
-
Save ntngel1/303623a5f961e41ecb8336c64c49325a to your computer and use it in GitHub Desktop.
What to do?
This file contains 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
interface UserGateway { | |
/* | |
Может вернуть response code 201, 400 или 404. | |
201 - все отлично, создали нового пользователя, нам возвращается UserModel созданого пользователя | |
400 - все хреново, возвращается обычный String с ошибкой | |
404 - все хреново, тоже возвращается String | |
Так вот, как все это обобщить? | |
Возвращать Single<Any> или Single<UserModel>??? Или что-то другое? | |
*/ | |
fun createUser(user: UserCreateRequestModel): Single<Any> | |
} | |
// Возвращает метод createUser в случае успешного запроса | |
data class UserModel( | |
val id: Int, | |
val email: Int, | |
val enabled: Boolean, | |
val phone: String, | |
val fullName: String, | |
val username: String, | |
val roles: List<String> | |
) | |
// модель для метода createUser при отправке запроса | |
data class UserCreateRequestModel( | |
val email: Int, | |
val phone: String, | |
val fullName: String, | |
val password: String, | |
val username: String, | |
val roles: List<String> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment