File tree 10 files changed +104
-12
lines changed
src/main/kotlin/io/appwrite
10 files changed +104
-12
lines changed Original file line number Diff line number Diff line change 2
2
3
3
![ Maven Central] ( https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square )
4
4
![ License] ( https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square )
5
- ![ Version] ( https://img.shields.io/badge/api%20version-0.8 .0-blue.svg?style=flat-square )
5
+ ![ Version] ( https://img.shields.io/badge/api%20version-0.9 .0-blue.svg?style=flat-square )
6
6
[ ![ Twitter Account] ( https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square )] ( https://twitter.com/appwrite_io )
7
7
[ ![ Discord] ( https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square )] ( https://appwrite.io/discord )
8
8
9
- ** This SDK is compatible with Appwrite server version 0.8 .x. For older versions, please check [ previous releases] ( https://github.com/appwrite/sdk-for-kotlin/releases ) .**
9
+ ** This SDK is compatible with Appwrite server version 0.9 .x. For older versions, please check [ previous releases] ( https://github.com/appwrite/sdk-for-kotlin/releases ) .**
10
10
11
11
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [ https://appwrite.io/docs ] ( https://appwrite.io/docs )
12
12
@@ -37,7 +37,7 @@ repositories {
37
37
Next, add the dependency to your project's ` build.gradle(.kts) ` file:
38
38
39
39
``` groovy
40
- implementation("io.appwrite:sdk-for-kotlin:0.0.0 ")
40
+ implementation("io.appwrite:sdk-for-kotlin:0.0.1 ")
41
41
```
42
42
43
43
### Maven
@@ -48,7 +48,7 @@ Add this to your project's `pom.xml` file:
48
48
<dependency >
49
49
<groupId >io.appwrite</groupId >
50
50
<artifactId >sdk-for-kotlin</artifactId >
51
- <version >0.0.0 </version >
51
+ <version >0.0.1 </version >
52
52
</dependency >
53
53
</dependencies >
54
54
```
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ plugins {
7
7
ext {
8
8
PUBLISH_GROUP_ID = ' io.appwrite'
9
9
PUBLISH_ARTIFACT_ID = ' sdk-for-kotlin'
10
- PUBLISH_VERSION = ' 0.0.0 '
10
+ PUBLISH_VERSION = ' 0.0.1 '
11
11
POM_URL = ' https://github.com/appwrite/sdk-for-kotlin'
12
12
POM_SCM_URL = ' https://github.com/appwrite/sdk-for-kotlin'
13
13
POM_ISSUE_URL = ' https://github.com/appwrite/sdk-for-kotlin/issues'
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ suspend fun main() {
11
11
val response = functions.create(
12
12
name = "[NAME]",
13
13
execute = listOf(),
14
- env = "dotnet-3.1 ",
14
+ runtime = "java-11.0 ",
15
15
)
16
16
val json = response.body?.string()
17
17
}
Original file line number Diff line number Diff line change
1
+ import io.appwrite.Client
2
+ import io.appwrite.services.Users
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
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
9
+
10
+ val users = Users(client)
11
+ val response = users.updateVerification(
12
+ userId = "[USER_ID]",
13
+ emailVerification = false
14
+ )
15
+ val json = response.body?.string()
16
+ }
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ class Client @JvmOverloads constructor(
47
47
init {
48
48
headers = mutableMapOf (
49
49
" content-type" to " application/json" ,
50
- " x-sdk-version" to " appwrite:kotlin:0.0.0 " ,
51
- " x-appwrite-response-format" to " 0.8 .0"
50
+ " x-sdk-version" to " appwrite:kotlin:0.0.1 " ,
51
+ " x-appwrite-response-format" to " 0.9 .0"
52
52
)
53
53
config = mutableMapOf ()
54
54
@@ -219,7 +219,13 @@ class Client @JvmOverloads constructor(
219
219
return @forEach
220
220
}
221
221
is List <* > -> {
222
- httpBuilder.addQueryParameter(it.key + " []" , it.value.toString())
222
+ val list = it.value as List <* >
223
+ for (index in list.indices) {
224
+ httpBuilder.addQueryParameter(
225
+ " ${it.key} []" ,
226
+ list[index].toString()
227
+ )
228
+ }
223
229
}
224
230
else -> {
225
231
httpBuilder.addQueryParameter(it.key, it.value.toString())
Original file line number Diff line number Diff line change @@ -332,6 +332,31 @@ class Account(private val client: Client) : BaseService(client) {
332
332
return client.call(" DELETE" , path, headers, params)
333
333
}
334
334
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
+
335
360
/* *
336
361
* Delete Account Session
337
362
*
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class Functions(private val client: Client) : BaseService(client) {
52
52
*
53
53
* @param name
54
54
* @param execute
55
- * @param env
55
+ * @param runtime
56
56
* @param vars
57
57
* @param events
58
58
* @param schedule
@@ -64,7 +64,7 @@ class Functions(private val client: Client) : BaseService(client) {
64
64
suspend fun create (
65
65
name : String ,
66
66
execute : List <Any >,
67
- env : String ,
67
+ runtime : String ,
68
68
vars : Any? = null,
69
69
events : List <Any >? = null,
70
70
schedule : String? = null,
@@ -74,7 +74,7 @@ class Functions(private val client: Client) : BaseService(client) {
74
74
val params = mapOf<String , Any ?>(
75
75
" name" to name,
76
76
" execute" to execute,
77
- " env " to env ,
77
+ " runtime " to runtime ,
78
78
" vars" to vars,
79
79
" events" to events,
80
80
" schedule" to schedule,
Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ class Storage(private val client: Client) : BaseService(client) {
195
195
* @param fileId
196
196
* @param width
197
197
* @param height
198
+ * @param gravity
198
199
* @param quality
199
200
* @param borderWidth
200
201
* @param borderColor
@@ -211,6 +212,7 @@ class Storage(private val client: Client) : BaseService(client) {
211
212
fileId : String ,
212
213
width : Int? = null,
213
214
height : Int? = null,
215
+ gravity : String? = null,
214
216
quality : Int? = null,
215
217
borderWidth : Int? = null,
216
218
borderColor : String? = null,
@@ -224,6 +226,7 @@ class Storage(private val client: Client) : BaseService(client) {
224
226
val params = mapOf<String , Any ?>(
225
227
" width" to width,
226
228
" height" to height,
229
+ " gravity" to gravity,
227
230
" quality" to quality,
228
231
" borderWidth" to borderWidth,
229
232
" borderColor" to borderColor,
Original file line number Diff line number Diff line change @@ -299,4 +299,31 @@ class Users(private val client: Client) : BaseService(client) {
299
299
return client.call(" PATCH" , path, headers, params)
300
300
}
301
301
302
+ /* *
303
+ * Update Email Verification
304
+ *
305
+ * Update the user email verification status by its unique ID.
306
+ *
307
+ * @param userId
308
+ * @param emailVerification
309
+ * @return [Response]
310
+ */
311
+ @JvmOverloads
312
+ @Throws(AppwriteException ::class )
313
+ suspend fun updateVerification (
314
+ userId : String ,
315
+ emailVerification : Boolean
316
+ ): Response {
317
+ val path = " /users/{userId}/verification" .replace(" {userId}" , userId)
318
+ val params = mapOf<String , Any ?>(
319
+ " emailVerification" to emailVerification
320
+ )
321
+
322
+ val headers = mapOf (
323
+ " content-type" to " application/json"
324
+ )
325
+
326
+ return client.call(" PATCH" , path, headers, params)
327
+ }
328
+
302
329
}
You can’t perform that action at this time.
0 commit comments