Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: Kotlin docs misc updates (#27655)

Tyler42f76def900f
diff --git a/apps/docs/docs/ref/kotlin/installing.mdx b/apps/docs/docs/ref/kotlin/installing.mdx
index e8e7c65b15f..f6e5c9ba8b3 100644
--- a/apps/docs/docs/ref/kotlin/installing.mdx
+++ b/apps/docs/docs/ref/kotlin/installing.mdx
@@ -8,7 +8,7 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
### Add one or more modules to your project
<RefSubLayout.EducationRow>
- <RefSubLayout.Examples>
+ <RefSubLayout.Details>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
<a href="https://github.com/supabase-community/supabase-kt/releases" style={{ marginRight: '8px' }}>
<img src="https://img.shields.io/github/release/supabase-community/supabase-kt?label=stable" alt="latest stable supabase-kt version"/>
@@ -17,39 +17,8 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
<img src="https://img.shields.io/maven-central/v/io.github.jan-tennert.supabase/supabase-kt?label=experimental" alt="latest supabase-kt version"/>
</a>
</div>
- Add dependency to your build file:
- <Tabs
- size="small"
- type="underlined"
- defaultActiveId="kotlin"
- queryGroup="build-file"
- >
- <TabPanel id="kotlin" label="build.gradle.kts">
-
- ```kotlin
- implementation("io.github.jan-tennert.supabase:[module]:VERSION")
- ```
- </TabPanel>
- <TabPanel id="groovy" label="build.gradle">
-
- ```groovy
- implementation 'io.github.jan-tennert.supabase:[module]:VERSION'
- ```
-
- </TabPanel>
- <TabPanel id="xml" label="pom.xml">
-
- ```xml
- <dependency>
- <groupId>io.github.jan-tennert.supabase</groupId>
- <artifactId>[module]</artifactId>
- <version>VERSION</version>
- </dependency>
- ```
-
- </TabPanel>
- </Tabs>
+ Add dependency to your build file using the BOM.
The available modules are:
- [**gotrue-kt**](https://github.com/supabase-community/supabase-kt/tree/master/GoTrue)
@@ -57,14 +26,10 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
- [**storage-kt**](https://github.com/supabase-community/supabase-kt/tree/master/Storage)
- [**functions-kt**](https://github.com/supabase-community/supabase-kt/tree/master/Functions)
- [**postgrest-kt**](https://github.com/supabase-community/supabase-kt/tree/master/Postgrest)
- - [apollo-graphql](https://github.com/supabase-community/supabase-kt/tree/master/plugins/ApolloGraphQL) - Creates an [Apollo GraphQL Client](https://github.com/apollographql/apollo-kotlin) for interacting with the Supabase API.
- - [compose-auth](https://github.com/supabase-community/supabase-kt/tree/master/plugins/ComposeAuth) - Provides easy Native Google & Apple Auth for Compose Multiplatform targets.
- - [compose-auth-ui](https://github.com/supabase-community/supabase-kt/tree/master/plugins/ComposeAuthUI) - Provides UI Components for Compose Multiplatform.
- - [coil-integration](https://github.com/supabase-community/supabase-kt/tree/master/plugins/CoilIntegration) - Provides a [Coil](https://github.com/coil-kt/coil) Integration for displaying images stored in Supabase Storage.
- - [imageloader-integration](https://github.com/supabase-community/supabase-kt/tree/master/plugins/ImageLoaderIntegration) - Provides a [Compose ImageLoader](https://github.com/qdsfdhvh/compose-imageloader) Integration for displaying images stored in Supabase Storage.
-
- When using multiple modules, you can also use the BOM dependency to ensure that all modules use the same version:
+ - Other plugins also available [here](https://github.com/supabase-community/supabase-kt/tree/master/plugins)
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
<Tabs
size="small"
type="underlined"
@@ -76,6 +41,7 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
```kotlin
implementation(platform("io.github.jan-tennert.supabase:bom:VERSION"))
implementation("io.github.jan-tennert.supabase:postgrest-kt")
+ implementation("io.github.jan-tennert.supabase:gotrue-kt")
implementation("io.github.jan-tennert.supabase:realtime-kt")
```
@@ -85,6 +51,7 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
```groovy
implementation platform("io.github.jan-tennert.supabase:bom:VERSION")
implementation 'io.github.jan-tennert.supabase:postgrest-kt'
+ implementation 'io.github.jan-tennert.supabase:gotrue-kt'
implementation 'io.github.jan-tennert.supabase:realtime-kt'
```
@@ -103,6 +70,10 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
<groupId>io.github.jan-tennert.supabase</groupId>
<artifactId>postgrest-kt</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.github.jan-tennert.supabase</groupId>
+ <artifactId>gotrue-kt</artifactId>
+ </dependency>
<dependency>
<groupId>io.github.jan-tennert.supabase</groupId>
<artifactId>realtime-kt</artifactId>
@@ -111,7 +82,6 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
</TabPanel>
</Tabs>
-
</RefSubLayout.Examples>
</RefSubLayout.EducationRow>
@@ -119,10 +89,12 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
### Add Ktor Client Engine to each of your Kotlin targets (required)
<RefSubLayout.EducationRow>
- <RefSubLayout.Examples>
+ <RefSubLayout.Details>
You can find a list of engines [here](https://ktor.io/docs/http-client-engines.html)
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
<Tabs
size="small"
type="underlined"
@@ -155,9 +127,15 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
</TabPanel>
</Tabs>
+ </RefSubLayout.Examples>
+
+ <RefSubLayout.Details>
Multiplatform example:
+ </RefSubLayout.Details>
+ <RefSubLayout.Examples>
+
<Tabs
size="small"
type="underlined"
diff --git a/apps/docs/spec/supabase_kt_v2.yml b/apps/docs/spec/supabase_kt_v2.yml
index 2637337fc05..b3f654165b0 100644
--- a/apps/docs/spec/supabase_kt_v2.yml
+++ b/apps/docs/spec/supabase_kt_v2.yml
@@ -4393,7 +4393,10 @@ functions:
isSpotlight: true
code: |
```kotlin
- supabase.functions.invoke("function_name")
+ val response = supabase.functions.invoke("function_name")
+
+ // Decode the response body to a serializable class
+ val data = response.body<FunctionResponse>()
```
- id: basic-invocation-with-body
name: Basic invocation with body
@@ -4410,6 +4413,8 @@ functions:
}
)
```
+ description: |
+ The return type of the invoking methods is an `HttpResponse`. You can access the response body via `response.body<T>()`, where `T` can be any serializable type.
- id: reuse-function
name: Reuse function by saving it to a variable
isSpotlight: true
@@ -4519,15 +4524,15 @@ functions:
data class Message(val content: String, val sender: String)
val channel = supabase.channel("channelId") {
- //optional config
+ // optional config
}
val broadcastFlow = channel.broadcastFlow<Message>(event = "message")
- //Collect the flow
- broadcastFlow.collect { //it: Message
+ // Collect the flow
+ broadcastFlow.onEach { // it: Message
println(it)
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe(blockUntilSubscribed = true)
@@ -4548,11 +4553,11 @@ functions:
val presenceFlow = channel.presenceDataFlow<PresenceState>()
//Collect the flow
- presenceFlow.collect {
+ presenceFlow.onEach {
for (presence in it) {
println(presence.username)
}
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe(blockUntilSubscribed = true)
//send your own state
@@ -4571,14 +4576,14 @@ functions:
val changeFlow = channel.postgresChangeFlow<PostgresAction>(schema = "public")
//Collect the flow
- changeFlow.collect {
+ changeFlow.onEach {
when(it) {
is PostgresAction.Delete -> println("Deleted: ${it.oldRecord}")
is PostgresAction.Insert -> println("Inserted: ${it.record}")
is PostgresAction.Select -> println("Selected: ${it.record}")
is PostgresAction.Update -> println("Updated: ${it.oldRecord} with ${it.record}")
}
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe()
```
@@ -4600,14 +4605,14 @@ functions:
}
//Collect the flow
- changeFlow.collect {
+ changeFlow.onEach {
when(it) {
is PostgresAction.Delete -> println("Deleted: ${it.oldRecord}")
is PostgresAction.Insert -> println("Inserted: ${it.record}")
is PostgresAction.Select -> println("Selected: ${it.record}")
is PostgresAction.Update -> println("Updated: ${it.oldRecord} with ${it.record}")
}
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe()
```
@@ -4627,9 +4632,9 @@ functions:
}
//Collect the flow
- changeFlow.collect {
+ changeFlow.onEach {
println(it.record)
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe()
```
@@ -4653,10 +4658,10 @@ functions:
}
//Collect the flow
- changeFlow.collect {
+ changeFlow.onEach {
println(it.record)
println(it.oldRecord)
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe()
```
@@ -4680,9 +4685,9 @@ functions:
}
//Collect the flow
- changeFlow.collect {
+ changeFlow.onEach {
println(it.oldRecord)
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe()
```
@@ -4707,9 +4712,9 @@ functions:
}
//Collect the flow
- changeFlow.collect {
+ changeFlow.onEach {
println(it.oldRecord)
- }
+ }.launchIn(coroutineScope) // launch a new coroutine to collect the flow
channel.subscribe()
```