Skip to content

Commit 093095e

Browse files
committed
feat: update the spec
1 parent 944026b commit 093095e

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

docs/examples/account/get-session.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Account
3+
4+
suspend fun main() {
5+
val client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
9+
10+
val account = Account(client)
11+
val response = account.getSession(
12+
sessionId = "[SESSION_ID]"
13+
)
14+
val json = response.body?.string()
15+
}

docs/examples/functions/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ suspend fun main() {
1111
val response = functions.create(
1212
name = "[NAME]",
1313
execute = listOf(),
14-
runtime = "java-11.0",
14+
runtime = "java-11",
1515
)
1616
val json = response.body?.string()
1717
}

src/main/kotlin/io/appwrite/Client.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Client @JvmOverloads constructor(
4848
headers = mutableMapOf(
4949
"content-type" to "application/json",
5050
"x-sdk-version" to "appwrite:kotlin:0.0.1",
51-
"x-appwrite-response-format" to "0.8.0"
51+
"x-appwrite-response-format" to "0.9.0"
5252
)
5353
config = mutableMapOf()
5454

src/main/kotlin/io/appwrite/services/Account.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,31 @@ class Account(private val client: Client) : BaseService(client) {
332332
return client.call("DELETE", path, headers, params)
333333
}
334334

335+
/**
336+
* Get Session By ID
337+
*
338+
* Use this endpoint to get a logged in user's session using a Session ID.
339+
* Inputting 'current' will return the current session being used.
340+
*
341+
* @param sessionId
342+
* @return [Response]
343+
*/
344+
@JvmOverloads
345+
@Throws(AppwriteException::class)
346+
suspend fun getSession(
347+
sessionId: String
348+
): Response {
349+
val path = "/account/sessions/{sessionId}".replace("{sessionId}", sessionId)
350+
val params = mapOf<String, Any?>(
351+
)
352+
353+
val headers = mapOf(
354+
"content-type" to "application/json"
355+
)
356+
357+
return client.call("GET", path, headers, params)
358+
}
359+
335360
/**
336361
* Delete Account Session
337362
*

0 commit comments

Comments
 (0)