Created
September 28, 2016 23:10
-
-
Save jpshelley/4893a19250a8e82d038b9466cdd306e1 to your computer and use it in GitHub Desktop.
gql-annotation-viewmodel
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
query Hero { | |
hero { | |
name, | |
isJedi | |
} | |
} |
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
class MyViewModel { | |
var heroNameText: String = getHero().name | |
var showIsJediImage: Boolean? = getHero().isJedi | |
@GraphQL(queryDocument = hero_query.graphql) | |
fun getHero(): Hero { | |
// . . . MyViewModelGQL could be the generated code after the annotation processor runs | |
// . . . The property "hero" is created based on the graphql file, and a getter is created. | |
// . . . Unsure where the actual GraphQL call is made to get the response, but this is just a rought draft. | |
return MyViewModelGQL.getHero() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment