Skip to content

Commit 219d800

Browse files
authored
[📚docs] give the README a bit of fresh paint (#6043)
* update badges * Rework the main page * add emojis * Use link instead of copying the logo everywhere * wording * uniformize badges style * Update README.md
1 parent f17c2be commit 219d800

File tree

3 files changed

+29
-263
lines changed

3 files changed

+29
-263
lines changed

README.md

Lines changed: 25 additions & 254 deletions
Original file line numberDiff line numberDiff line change
@@ -1,273 +1,44 @@
1+
<div align="center">
12

2-
# Apollo Kotlin
3+
<p>
4+
<a href="https://www.apollographql.com/"><img src="https://raw.githubusercontent.com/apollographql/apollo-client-devtools/a7147d7db5e29b28224821bf238ba8e3a2fdf904/assets/apollo-wordmark.svg" height="100" alt="Apollo Client"></a>
5+
</p>
36

4-
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg?maxAge=2592000)](https://raw.githubusercontent.com/apollographql/apollo-kotlin/main/LICENSE)
5-
[![Join the community](https://img.shields.io/discourse/status?label=Join%20the%20community&server=https%3A%2F%2Fcommunity.apollographql.com)](http://community.apollographql.com/new-topic?category=Help&tags=mobile,client)
6-
[![Slack](https://img.shields.io/static/v1?label=kotlinlang&message=apollo-kotlin&color=15a2f5&logo=slack)](https://app.slack.com/client/T09229ZC6/C01A6KM1SBZ)
7+
[![Discourse](https://img.shields.io/discourse/topics?label=Discourse&server=https%3A%2F%2Fcommunity.apollographql.com&logo=discourse&color=467B95&style=flat-square)](http://community.apollographql.com/new-topic?category=Help&tags=mobile,client)
8+
[![Slack](https://img.shields.io/static/v1?label=kotlinlang&message=apollo-kotlin&color=A97BFF&logo=slack&style=flat-square)](https://app.slack.com/client/T09229ZC6/C01A6KM1SBZ)
79
[![Discord](https://img.shields.io/discord/1022972389463687228.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square)](https://discord.com/invite/graphos)
8-
[![CI](https://img.shields.io/github/actions/workflow/status/apollographql/apollo-kotlin/push.yml?branch=main)](https://github.com/apollographql/apollo-kotlin/actions/workflows/push.yml?query=branch%3Amain)
9-
[![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo/apollo-api)](https://repo1.maven.org/maven2/com/apollographql/apollo/)
10-
[![Gradle Plugin](https://img.shields.io/gradle-plugin-portal/v/com.apollographql.apollo)](https://plugins.gradle.org/plugin/com.apollographql.apollo)
11-
[![OSS Snapshots](https://img.shields.io/nexus/s/com.apollographql.apollo/apollo-api?server=https%3A%2F%2Fs01.oss.sonatype.org&label=oss-snapshots)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo/)
12-
[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.apollographql.com/scans)
1310

14-
| ☑️ Apollo Clients User Survey |
15-
| :----- |
16-
| What do you like best about Apollo Kotlin? What needs to be improved? Please tell us by taking a [one-minute survey](https://docs.google.com/forms/d/e/1FAIpQLSczNDXfJne3ZUOXjk9Ursm9JYvhTh1_nFTDfdq3XBAFWCzplQ/viewform?usp=pp_url&entry.1170701325=Apollo+Kotlin&entry.204965213=Readme). Your responses will help us understand Apollo Kotlin usage and allow us to serve you better. |
17-
18-
Apollo Kotlin (formerly Apollo Android) is a GraphQL client that generates Kotlin and Java models from GraphQL operations.
19-
20-
Apollo Kotlin executes operations against a GraphQL server and returns results as operation-specific Kotlin types. This means you don't have to deal with parsing JSON, or passing around `Map`s and making clients cast values to the right type manually. You also don't have to write model types yourself, because these are generated from the GraphQL definitions your app uses.
21-
22-
Because generated types are operation-specific, you can only access data that you actually specify as part of an operation. If you don't ask for a particular field in an operation, you can't access the corresponding property on the returned data structure.
23-
24-
This library is designed primarily with Android in mind, but you can use it in any Kotlin (including multiplatform) and Java app.
25-
26-
## Features
27-
28-
* Kotlin Multiplatform and Java code generation
29-
* Queries, Mutations and Subscriptions
30-
* Reflection-free parsing
31-
* Normalized cache
32-
* Custom scalar types
33-
* HTTP cache
34-
* Auto Persisted Queries
35-
* Query batching
36-
* File uploads
37-
* Fake models for tests
38-
* AppSync and graphql-ws websockets
39-
* GraphQL AST parser
40-
* Plugin for Android Studio and IntelliJ
41-
42-
## Multiplatform
43-
44-
Apollo Kotlin is a [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) project.
45-
46-
Here's the current matrix of supported features per platform:
47-
48-
| | `jvm` | `Apple¹` | `js` | `wasmJs` | `linuxX64` |
49-
|------------------------------------------------------|:-----:|:--------:|:----:|:--------:|:----------:|
50-
| `apollo-api` (models) ||||||
51-
| `apollo-runtime` (network, query batching, apq, ...) ||||| 🚫 |
52-
| `apollo-normalized-cache` ||||| 🚫 |
53-
| `apollo-adapters` ||||| 🚫 |
54-
| `apollo-normalized-cache-sqlite` ||| 🚫 | 🚫 | 🚫 |
55-
| `apollo-http-cache` || 🚫 | 🚫 | 🚫 | 🚫 |
56-
57-
¹: Apple currently includes:
58-
59-
- `macosX64`
60-
- `macosArm64`
61-
- `iosArm64`
62-
- `iosX64`
63-
- `iosSimulatorArm64`
64-
- `watchosArm32`
65-
- `watchosArm64`
66-
- `watchosSimulatorArm64`
67-
- `tvosArm64`
68-
- `tvosX64`
69-
- `tvosSimulatorArm64`
70-
71-
## Maintainers
72-
73-
* [martinbonnin](https://github.com/martinbonnin)
74-
* [BoD](https://github.com/BoD)
75-
* [@bignimbus](https://github.com/bignimbus)
76-
77-
## Documentation
78-
79-
Check [the project website](https://www.apollographql.com/docs/android/) for in depth documentation.
80-
81-
## Getting started
82-
83-
If you are new to GraphQL, check out [the tutorial](https://www.apollographql.com/docs/android/tutorial/00-introduction/) that will guide you through building an Android app using Apollo.
84-
85-
If you'd like to add Apollo Kotlin to an existing project, follow these steps:
86-
87-
Add the plugin to your `build.gradle.kts`:
88-
89-
```kotlin
90-
plugins {
91-
id("com.apollographql.apollo") version "4.0.0-rc.1"
92-
}
93-
```
94-
95-
Add the runtime dependency:
96-
97-
```kotlin
98-
dependencies {
99-
implementation("com.apollographql.apollo:apollo-runtime:4.0.0-rc.1")
100-
}
101-
```
102-
103-
Set the package name to use for the generated models:
104-
105-
```kotlin
106-
apollo {
107-
service("service") {
108-
packageName.set("com.example")
109-
}
110-
}
111-
```
112-
113-
Apollo Kotlin supports three types of files:
114-
- `.graphqls` schema files: describes the types in your backend using the GraphQL syntax.
115-
- `.json` schema files: describes the types in your backend using the Json syntax.
116-
- `.graphql` executable files: describes your queries and operations in the GraphQL syntax.
117-
118-
By default, Apollo Kotlin requires a schema in your module's `src/main/graphql` directory. You can download a schema using introspection with the `./gradlew downloadApolloSchema` task. Sometimes introspection is disabled and you will have to ask your backend team to provide a schema. Copy this schema to your module:
119-
120-
```
121-
cp ${schema} ${module}/src/main/graphql/
122-
```
123-
124-
Write a query in a `${module}/src/main/graphql/HeroQuery.graphql` file:
11+
[![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo/apollo-api?style=flat-square)](https://central.sonatype.com/namespace/com.apollographql.apollo)
12+
[![OSS Snapshots](https://img.shields.io/nexus/s/com.apollographql.apollo/apollo-api?server=https%3A%2F%2Fs01.oss.sonatype.org&label=oss-snapshots&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo/)
12513

126-
```graphql
127-
query HeroQuery($id: String!) {
128-
hero(id: $id) {
129-
id
130-
name
131-
appearsIn
132-
}
133-
}
134-
```
14+
[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A&style=flat-square)](https://ge.apollographql.com/scans)
13515

136-
Build your project. This will generate a `HeroQuery` class that you can use with an instance of `ApolloClient`:
16+
</div>
13717

138-
```kotlin
139-
// Create a client
140-
val apolloClient = ApolloClient.Builder()
141-
.serverUrl("https://example.com/graphql")
142-
.build()
14318

144-
// Execute your query. This will suspend until the response is received.
145-
val response = apolloClient.query(HeroQuery(id = "1")).execute()
146-
147-
println("Hero.name=${response.data?.hero?.name}")
148-
```
149-
150-
**To learn more about other Apollo Kotlin APIs:**
151-
152-
* Execute your first [mutation](https://www.apollographql.com/docs/kotlin/essentials/mutations/)
153-
* Handle [custom scalar types](https://www.apollographql.com/docs/kotlin/essentials/custom-scalars/)
154-
* Factor common patterns using [fragments](https://www.apollographql.com/docs/kotlin/essentials/fragments/)
155-
156-
## Requirements
157-
158-
Some platforms have specific runtime requirements:
159-
160-
* JVM 8+
161-
* Android API level 21+ (`apollo-http-cache` and `apollo-adapters` require enabling [core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) on Android API levels < 26)
162-
* iOS 13+
163-
164-
At build time, it requires:
165-
166-
* Gradle 8.0+
167-
* Kotlin 1.9+ for JVM projects
168-
* Kotlin 2.0+ for native, JS, and Wasm projects
169-
170-
## Proguard / R8 configuration
171-
172-
As the code generated by Apollo Kotlin doesn't use any reflection, it can safely be optimized / obfuscated by Proguard or R8, so no particular exclusions need to be configured.
173-
174-
## Android Studio / IntelliJ plugin
175-
176-
A [plugin for Android Studio and IntelliJ](https://plugins.jetbrains.com/plugin/20645-apollo-graphql) is available to help you work with Apollo Kotlin, providing automatic code generation, integration with the [GraphQL IntelliJ Plugin](https://plugins.jetbrains.com/plugin/8097-js-graphql), navigation to GraphQL definitions, migration helpers, and more.
177-
178-
Installation instructions and more information can be found [here](https://github.com/apollographql/apollo-kotlin/tree/main/intellij-plugin).
179-
180-
## Releases
181-
182-
The latest version is [![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo/apollo-api)](https://repo1.maven.org/maven2/com/apollographql/apollo/)
183-
184-
Check the [changelog](https://github.com/apollographql/apollo-kotlin/releases) for the release history.
185-
186-
Releases are hosted on [Maven Central](https://repo1.maven.org/maven2/com/apollographql/apollo/). The plugin is additionally hosted on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/com.apollographql.apollo)
187-
188-
```kotlin
189-
plugins {
190-
id("com.apollographql.apollo") version "4.0.0-rc.1"
191-
}
192-
193-
repositories {
194-
mavenCentral()
195-
}
196-
197-
dependencies {
198-
implementation("com.apollographql.apollo:apollo-runtime:4.0.0-rc.1")
199-
200-
// Optional: if you want to use the normalized cache
201-
implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:4.0.0-rc.1")
202-
// Optional: if you just want the generated models and parsers and write your own HTTP code/cache code, you can remove apollo-runtime
203-
// and use apollo-api instead
204-
implementation("com.apollographql.apollo:apollo-api:4.0.0-rc.1")
205-
}
206-
```
207-
208-
## Snapshots
209-
210-
Latest development changes are available in Sonatype's snapshots repository:
211-
212-
```kotlin
213-
// build.gradle.kts
214-
repositories {
215-
maven {
216-
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
217-
}
218-
mavenCentral()
219-
// other repositories...
220-
}
221-
222-
// settings.gradle.kts
223-
pluginManagement {
224-
repositories {
225-
maven {
226-
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
227-
}
228-
gradlePluginPortal()
229-
mavenCentral()
230-
// other repositories...
231-
}
232-
}
233-
```
234-
235-
And then use the `4.0.0-rc.2-SNAPSHOT` version for the plugin and libraries.
236-
237-
These snapshots are updated on each push to `main`.
238-
239-
Weekly snapshots for the Android Studio / IntelliJ plugin [are also available](tree/main/intellij-plugin#weekly-snapshots).
240-
241-
## Stability of different artifacts
19+
| ☑️ Apollo Clients User Survey |
20+
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
21+
| What do you like best about Apollo Kotlin? What needs to be improved? Please tell us by taking a [one-minute survey](https://docs.google.com/forms/d/e/1FAIpQLSczNDXfJne3ZUOXjk9Ursm9JYvhTh1_nFTDfdq3XBAFWCzplQ/viewform?usp=pp_url&entry.1170701325=Apollo+Kotlin&entry.204965213=Readme). Your responses will help us understand Apollo Kotlin usage and allow us to serve you better. |
24222

243-
Apollo Kotlin is very modular and publishes several artifacts.
23+
## 🚀 Apollo Kotlin
24424

245-
* Artifacts ending with `-incubating` are not finalized yet and subject to change any time.
246-
* Other artifacts observe [Semantic Versioning](https://semver.org/).
247-
* No breaking change should be introduced in minor or patch releases except for symbols annotated with `@ApolloExperimental` that are subject to change at any time.
248-
* Deprecated symbols may be removed in the next major release. We strongly recommend removing deprecated usages before migrating to the next major version.
25+
Apollo Kotlin is a strongly typed GraphQL client that generates Kotlin models for your GraphQL operations.
24926

250-
## Contributing
27+
Apollo Kotlin executes operations against a GraphQL server and returns results as operation-specific Kotlin types. This means you don't have to deal with parsing JSON, or passing around `Map`s and making clients cast values to the right type manually. You also don't have to write model types yourself, because these are generated from the GraphQL definitions your app uses.
25128

252-
If you'd like to contribute, please see [Contributing.md](https://github.com/apollographql/apollo-kotlin/blob/main/CONTRIBUTING.md).
29+
Because generated types are operation-specific, you can only access data that you actually specify as part of an operation. If you don't ask for a particular field in an operation, you can't access the corresponding property on the returned data structure.
25330

254-
## Community integrations
31+
This library is designed with Android in mind, but you can use it in any Kotlin application, including multiplatform.
25532

256-
* If you're using the [Maven](https://maven.apache.org/) build tool, [apollo-client-maven-plugin](https://github.com/aoudiamoncef/apollo-client-maven-plugin) is a Maven plugin that calls the Apollo Kotlin compiler to generate your Java/Kotlin sources.
257-
* If you're using [Absinthe Phoenix subscriptions](https://hexdocs.pm/absinthe_phoenix/readme.html), [kotlin-phoenix](https://github.com/ajacquierbret/kotlin-phoenix) has a [PhoenixNetworkTransport](https://github.com/ajacquierbret/kotlin-phoenix/blob/main/kotlinphoenix-adapters/src/commonMain/kotlin/io/github/ajacquierbret/kotlinphoenix/adapters/apollo/PhoenixNetworkTransport.kt) that you can use together with `ApolloClient` ([doc](https://github.com/ajacquierbret/kotlin-phoenix/tree/main/kotlinphoenix-adapters))
33+
## 📚 Documentation
25834

259-
## Additional resources
35+
All Apollo Kotlin documentation, including caching and helpful recipes, can be found at: <br/>
36+
[https://www.apollographql.com/docs/kotlin/](https://www.apollographql.com/docs/kotlin/)
26037

261-
- [Confetti](https://github.com/joreilly/Confetti): A Kotlin Multiplatform conference app using Apollo Kotlin, SwiftUI and Jetpack Compose.
262-
- [MortyComposeKMM](https://github.com/joreilly/MortyComposeKMM): A Kotlin Multiplatform Github template using Apollo Kotlin, SwiftUI and Jetpack Compose.
263-
- [A journey to Kotlin multiplatform](https://www.youtube.com/watch?v=GN6LHrqyimI): how the project was moved to Kotlin multiplatform, talk given at Kotliners in June 2020.
264-
- [#125, Fragmented Podcast](http://fragmentedpodcast.com/episodes/125/): Why's and How's about Apollo Kotlin and the entire journey.
265-
- [GraphQL.org](http://graphql.org) for an introduction and reference to GraphQL itself.
266-
- [apollographql.com](http://www.apollographql.com/) to learn about Apollo open-source and commercial tools.
267-
- [The Apollo blog](https://www.apollographql.com/blog/) for long-form articles about GraphQL, feature announcements for Apollo, and guest articles from the community.
268-
- [The Apollo Twitter account](https://twitter.com/apollographql) for in-the-moment news.
38+
The Apollo Kotlin API reference can be found at: <br/>
39+
[https://apollographql.github.io/apollo-kotlin/kdoc/](https://apollographql.github.io/apollo-kotlin/kdoc/)
26940

270-
## Who is Apollo?
41+
## 👨‍💻 Who is Apollo?
27142

27243
[Apollo](https://apollographql.com/) builds open-source software and a graph platform to unify GraphQL across your apps and services. We help you ship faster with:
27344

@@ -276,6 +47,6 @@ If you'd like to contribute, please see [Contributing.md](https://github.com/apo
27647
* [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin).
27748
* [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.
27849

279-
## Learn how to build with Apollo
50+
## 🎓 Learn how to build with Apollo
28051

28152
Check out the [Odyssey](https://odyssey.apollographql.com/) learning platform, the perfect place to start your GraphQL journey with videos and interactive code challenges. Join the [Apollo Community](https://community.apollographql.com/) to interact with and get technical help from the GraphQL community.

build.gradle.kts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,9 @@ configure<kotlinx.validation.ApiValidationExtension> {
138138
"com.apollographql.apollo.runtime.java.network.http.internal",
139139
)
140140
)
141-
ignoredProjects.addAll(
142-
rootDir.resolve("libraries")
143-
.listFiles()!!
144-
.filter { it.resolve("build.gradle.kts").exists() }
145-
.map { it.name }
146-
.filter { it.endsWith("-incubating") }
147-
+ "intellij-plugin"
148-
)
141+
142+
ignoredProjects.add("intellij-plugin")
143+
149144
nonPublicMarkers.addAll(
150145
listOf(
151146
"com.apollographql.apollo.annotations.ApolloInternal",

docs/source/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Apollo Kotlin is very modular and publishes several artifacts.
229229

230230
## Contributing
231231

232-
If you'd like to contribute, please see [Contributing.md](https://github.com/apollographql/apollo-kotlin/blob/main/CONTRIBUTING.md).
232+
If you'd like to contribute, please see [CONTRIBUTING.md](https://github.com/apollographql/apollo-kotlin/blob/main/CONTRIBUTING.md).
233233

234234
## Community integrations
235235

0 commit comments

Comments
 (0)