Created
November 24, 2017 17:15
-
-
Save luks91/f512e7ad2cbc6261db889d13f884d44a 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
| data class Credentials(val username: String, val password: String) | |
| interface ContactsApi { | |
| fun getContacts(credentials: Credentials): Flowable<SimpleContact> | |
| companion object { | |
| fun createFor(serverUrl: String) = object: ContactsApi { | |
| override fun getContacts(credentials: Credentials): | |
| Flowable<SimpleContact> { | |
| Log.i("ContactsApi", | |
| "Querying for contacts from $serverUrl with $credentials") | |
| return Flowable.just( | |
| SimpleContact("Contact1", isStarred = false), | |
| SimpleContact("Contact2", isStarred = false), | |
| SimpleContact("Contact3", isStarred = true) | |
| ) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment