Jakub
11/02/2018, 10:41 AMkarelpeeters
11/02/2018, 10:48 AMAccount
class that had a function to send requests with the appropriate sessions id etc, it had a parameter for extra parameters on the request.
Then on Account there were functions that returned some data about it, eg Account.contacts(): List<Contact>
. Those Contact objects looked somewhat like this:
data class Contact(val account: Account, val name: String) {
fun details(): ContactDetails {
return parse<ContactDetails>(account.sendRequest("contact/$name"))
}
}
And then ContactDetails
kept a reference to the Contact
object as well, something like:
data class ContactDetails(val contact: Contact, val name: String, val age: Int)
Jakub
11/02/2018, 11:14 AM