在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):AniTrend/retrofit-graphql开源软件地址(OpenSource Url):https://github.com/AniTrend/retrofit-graphql开源编程语言(OpenSource Language):Kotlin 99.9%开源软件介绍(OpenSource Introduction):Retrofit Converter - With GraphQL SupportSeeing how we already have a really powerful type-safe HTTP client for Android and Java Retrofit why not use it and extend it's functionality, this project is a retrofit converter which uses annotations to inject .graphql query or mutation file contents into a request body along with any GraphQL variables. Why This Project Exists?Many might wonder why this exists when an android GraphQL library like Apollo exists. Unfortunately Apollo for Android still lacks some basic but important features/functionality which led to the following questions about General Design Questions Regarding Apollo, Polymorphic Type Handling and Non Shared Types. Don't get me wrong Apollo is not inferior any way, it has amazing features such as:
But since model classes are automatically generated for you, the developer loses some flexibility, such as use of generics, abstraction and inheritance. Also Android Performance best practice suggests that developers should use StringDef and IntDef over enums and here's why, with the exception of kotlin especially when using R8. Strangely there are tons of simple examples all over Medium using apollo graphql for Android, but none of them address these issues because most of them just construct a simple single resource request demo application. These look just fine at first glance until you start working with multiple data types and apollo starts generating classes for every fragment and query even if the data models are the same, or share similar properties. See a list of changes from here How Everything WorksGetting Started
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
dependencies {
implementation 'com.github.anitrend:retrofit-graphql:{latest_version}'
}
If you are using R8 the shrinking and obfuscation rules are included automatically. ProGuard users must manually copy the options from this file.
ExamplesDefine, your If you use insomnia you can use this tool to generate your workspaces into directories and files insomnia-graphql-generator. After you can simply place the generated content into your assets folder e.g.:
For more instructions on how to setup the sample app and other examples with file uploads, persisted queries, custom loggers, custom graphql files location (outside assets) please visit the projects wiki page Screenshots |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论