Guest User

Untitled

a guest
Nov 26th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. data class Credentials(val username: String, val password: String)
  2.  
  3. interface ContactsApi {
  4. fun getContacts(credentials: Credentials): Flowable<SimpleContact>
  5.  
  6. companion object {
  7. fun createFor(serverUrl: String) = object: ContactsApi {
  8. override fun getContacts(credentials: Credentials):
  9. Flowable<SimpleContact> {
  10. Log.i("ContactsApi",
  11. "Querying for contacts from $serverUrl with $credentials")
  12. return Flowable.just(
  13. SimpleContact("Contact1", isStarred = false),
  14. SimpleContact("Contact2", isStarred = false),
  15. SimpleContact("Contact3", isStarred = true)
  16. )
  17. }
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment