Skip to content

Commit 3345f64

Browse files
committed
feat: review comments
1 parent cd08be2 commit 3345f64

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Appwrite is an open-source backend as a service server that abstract and simplif
1515

1616
### Gradle
1717

18-
Appwrite's Android SDK is hosted on Maven Central. In order to fetch the Appwrite SDK, add this to your root level `build.gradle(.kts)` file:
18+
Appwrite's Kotlin SDK is hosted on Maven Central. In order to fetch the Appwrite SDK, add this to your root level `build.gradle(.kts)` file:
1919

2020
```groovy
2121
repositories {

gradlew

100644100755
File mode changed.

scripts/publish.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ apply(plugin: "signing")
44
java {
55
withJavadocJar()
66
withSourcesJar()
7+
toolchain {
8+
languageVersion = JavaLanguageVersion.of(8)
9+
vendor = JvmVendorSpec.ADOPTOPENJDK
10+
}
711
}
812

913
publishing {

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

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,71 @@ class Client @JvmOverloads constructor(
5555
setSelfSigned(selfSigned)
5656
}
5757

58-
/// Your project ID
58+
/**
59+
* Set Project
60+
*
61+
* Your project ID
62+
*
63+
* @param {string} project
64+
*
65+
* @return this
66+
*/
5967
fun setProject(value: String): Client {
6068
config["project"] = value
6169
addHeader("x-appwrite-project", value)
6270
return this
6371
}
6472

65-
/// Your secret API key
73+
/**
74+
* Set Key
75+
*
76+
* Your secret API key
77+
*
78+
* @param {string} key
79+
*
80+
* @return this
81+
*/
6682
fun setKey(value: String): Client {
6783
config["key"] = value
6884
addHeader("x-appwrite-key", value)
6985
return this
7086
}
7187

72-
/// Your secret JSON Web Token
88+
/**
89+
* Set JWT
90+
*
91+
* Your secret JSON Web Token
92+
*
93+
* @param {string} jwt
94+
*
95+
* @return this
96+
*/
7397
fun setJWT(value: String): Client {
7498
config["jWT"] = value
7599
addHeader("x-appwrite-jwt", value)
76100
return this
77101
}
78102

103+
/**
104+
* Set Locale
105+
*
106+
* @param {string} locale
107+
*
108+
* @return this
109+
*/
79110
fun setLocale(value: String): Client {
80111
config["locale"] = value
81112
addHeader("x-appwrite-locale", value)
82113
return this
83114
}
84115

116+
/**
117+
* Set self Signed
118+
*
119+
* @param status
120+
*
121+
* @return this
122+
*/
85123
fun setSelfSigned(status: Boolean): Client {
86124
selfSigned = status
87125

@@ -123,16 +161,41 @@ class Client @JvmOverloads constructor(
123161
return this
124162
}
125163

164+
/**
165+
* Set endpoint
166+
*
167+
* @param endpoint
168+
*
169+
* @return this
170+
*/
126171
fun setEndpoint(endPoint: String): Client {
127172
this.endPoint = endPoint
128173
return this
129174
}
130175

176+
/**
177+
* Add Header
178+
*
179+
* @param key
180+
* @param value
181+
*
182+
* @return this
183+
*/
131184
fun addHeader(key: String, value: String): Client {
132185
headers[key] = value
133186
return this
134187
}
135188

189+
/**
190+
* Send the HTTP request
191+
*
192+
* @param method
193+
* @param path
194+
* @param headers
195+
* @param params
196+
*
197+
* @return [Response]
198+
*/
136199
@Throws(AppwriteException::class)
137200
suspend fun call(
138201
method: String,
@@ -210,6 +273,16 @@ class Client @JvmOverloads constructor(
210273
return awaitResponse(request)
211274
}
212275

276+
/**
277+
* Await Response
278+
*
279+
* @param method
280+
* @param path
281+
* @param headers
282+
* @param params
283+
*
284+
* @return [Response]
285+
*/
213286
@Throws(AppwriteException::class)
214287
private suspend fun awaitResponse(request: Request) = suspendCancellableCoroutine<Response> {
215288
http.newCall(request).enqueue(object : Callback {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class Storage(private val client: Client) : BaseService(client) {
195195
* @param fileId
196196
* @param width
197197
* @param height
198+
* @param gravity
198199
* @param quality
199200
* @param borderWidth
200201
* @param borderColor
@@ -211,6 +212,7 @@ class Storage(private val client: Client) : BaseService(client) {
211212
fileId: String,
212213
width: Int? = null,
213214
height: Int? = null,
215+
gravity: String? = null,
214216
quality: Int? = null,
215217
borderWidth: Int? = null,
216218
borderColor: String? = null,
@@ -224,6 +226,7 @@ class Storage(private val client: Client) : BaseService(client) {
224226
val params = mapOf<String, Any?>(
225227
"width" to width,
226228
"height" to height,
229+
"gravity" to gravity,
227230
"quality" to quality,
228231
"borderWidth" to borderWidth,
229232
"borderColor" to borderColor,

0 commit comments

Comments
 (0)