Extends Supabase-kt with an Apollo GraphQL Client.
dependencies {
implementation("io.github.jan-tennert.supabase:apollo-graphql:VERSION")
}
Install plugin in main SupabaseClient. See the documentation for more information
val client = createSupabaseClient(
supabaseUrl = "https://id.supabase.co",
supabaseKey = "apikey"
) {
//...
install(GraphQL) {
apolloConfiguration {
// settings
}
}
}
The plugin automatically creates an Apollo Client with the corresponding headers for Authorization depending on your session.
To access the client, you can use the apolloClient
property of the GraphQL
plugin instance.
client.graphql.apolloClient.query(YourQuery()).execute().data //execute a query
To learn about how to use Apollo GraphQL, see Apollo Kotlin.