Skip to content

Commit c0c5bb6

Browse files
authored
Merge pull request #33 from appwrite/dev
fix: patch updates for appwrite 1.4.1
2 parents 3455cef + ff71d2c commit c0c5bb6

13 files changed

+700
-657
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939
Next, add the dependency to your project's `build.gradle(.kts)` file:
4040

4141
```groovy
42-
implementation("io.appwrite:sdk-for-kotlin:3.0.0")
42+
implementation("io.appwrite:sdk-for-kotlin:3.0.1")
4343
```
4444

4545
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
5050
<dependency>
5151
<groupId>io.appwrite</groupId>
5252
<artifactId>sdk-for-kotlin</artifactId>
53-
<version>3.0.0</version>
53+
<version>3.0.1</version>
5454
</dependency>
5555
</dependencies>
5656
```

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class Client @JvmOverloads constructor(
6262
init {
6363
headers = mutableMapOf(
6464
"content-type" to "application/json",
65-
"user-agent" to "AppwriteKotlinSDK/3.0.0 ${System.getProperty("http.agent")}",
65+
"user-agent" to "AppwriteKotlinSDK/3.0.1 ${System.getProperty("http.agent")}",
6666
"x-sdk-name" to "Kotlin",
6767
"x-sdk-platform" to "server",
6868
"x-sdk-language" to "kotlin",
69-
"x-sdk-version" to "3.0.0", "x-appwrite-response-format" to "1.4.0"
69+
"x-sdk-version" to "3.0.1", "x-appwrite-response-format" to "1.4.0"
7070
)
7171
config = mutableMapOf()
7272

@@ -368,7 +368,7 @@ class Client @JvmOverloads constructor(
368368
responseType = Map::class.java,
369369
)
370370
val chunksUploaded = current["chunksUploaded"] as Long
371-
offset = (chunksUploaded * CHUNK_SIZE).coerceAtMost(size)
371+
offset = chunksUploaded * CHUNK_SIZE
372372
}
373373

374374
while (offset < size) {
@@ -379,7 +379,7 @@ class Client @JvmOverloads constructor(
379379
}
380380
"bytes" -> {
381381
val end = if (offset + CHUNK_SIZE < size) {
382-
offset + CHUNK_SIZE
382+
offset + CHUNK_SIZE - 1
383383
} else {
384384
size - 1
385385
}
@@ -399,7 +399,7 @@ class Client @JvmOverloads constructor(
399399
)
400400

401401
headers["Content-Range"] =
402-
"bytes $offset-${((offset + CHUNK_SIZE) - 1).coerceAtMost(size)}/$size"
402+
"bytes $offset-${((offset + CHUNK_SIZE) - 1).coerceAtMost(size - 1)}/$size"
403403

404404
result = call(
405405
method = "POST",

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

+43
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,72 @@
11
package io.appwrite
22

3+
/**
4+
* Helper class to generate role strings for [Permission].
5+
*/
36
class Role {
47
companion object {
8+
9+
/**
10+
* Grants access to anyone.
11+
*
12+
* This includes authenticated and unauthenticated users.
13+
*/
514
fun any(): String = "any"
615

16+
/**
17+
* Grants access to a specific user by user ID.
18+
*
19+
* You can optionally pass verified or unverified for
20+
* [status] to target specific types of users.
21+
*/
722
fun user(id: String, status: String = ""): String = if(status.isEmpty()) {
823
"user:$id"
924
} else {
1025
"user:$id/$status"
1126
}
1227

28+
/**
29+
* Grants access to any authenticated or anonymous user.
30+
*
31+
* You can optionally pass verified or unverified for
32+
* [status] to target specific types of users.
33+
*/
1334
fun users(status: String = ""): String = if(status.isEmpty()) {
1435
"users"
1536
} else {
1637
"users/$status"
1738
}
1839

40+
/**
41+
* Grants access to any guest user without a session.
42+
*
43+
* Authenticated users don't have access to this role.
44+
*/
1945
fun guests(): String = "guests"
2046

47+
/**
48+
* Grants access to a team by team ID.
49+
*
50+
* You can optionally pass a role for [role] to target
51+
* team members with the specified role.
52+
*/
2153
fun team(id: String, role: String = ""): String = if(role.isEmpty()) {
2254
"team:$id"
2355
} else {
2456
"team:$id/$role"
2557
}
2658

59+
/**
60+
* Grants access to a specific member of a team.
61+
*
62+
* When the member is removed from the team, they will
63+
* no longer have access.
64+
*/
2765
fun member(id: String): String = "member:$id"
66+
67+
/**
68+
* Grants access to a user with the specified label.
69+
*/
70+
fun label(name: String): String = "label:$name"
2871
}
2972
}

0 commit comments

Comments
 (0)