Skip to content

Commit 15ebb4f

Browse files
committed
fix: minor bugs
1 parent 19185d9 commit 15ebb4f

File tree

13 files changed

+48
-47
lines changed

13 files changed

+48
-47
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.5.4-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

@@ -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:5.0.1")
42+
implementation("io.appwrite:sdk-for-kotlin:5.0.2")
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>5.0.1</version>
53+
<version>5.0.2</version>
5454
</dependency>
5555
</dependencies>
5656
```

docs/examples/java/messaging/update-email.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ messaging.updateEmail(
2121
listOf(), // cc (optional)
2222
listOf(), // bcc (optional)
2323
"", // scheduledAt (optional)
24+
listOf(), // attachments (optional)
2425
new CoroutineCallback<>((result, error) -> {
2526
if (error != null) {
2627
error.printStackTrace();

docs/examples/kotlin/messaging/update-email.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ val response = messaging.updateEmail(
2020
html = false, // optional
2121
cc = listOf(), // optional
2222
bcc = listOf(), // optional
23-
scheduledAt = "" // optional
23+
scheduledAt = "", // optional
24+
attachments = listOf() // optional
2425
)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ class Client @JvmOverloads constructor(
5757
init {
5858
headers = mutableMapOf(
5959
"content-type" to "application/json",
60-
"user-agent" to "AppwriteKotlinSDK/5.0.1 ${System.getProperty("http.agent")}",
60+
"user-agent" to "AppwriteKotlinSDK/5.0.2 ${System.getProperty("http.agent")}",
6161
"x-sdk-name" to "Kotlin",
6262
"x-sdk-platform" to "server",
6363
"x-sdk-language" to "kotlin",
64-
"x-sdk-version" to "5.0.1",
64+
"x-sdk-version" to "5.0.2",
6565
"x-appwrite-response-format" to "1.5.0",
6666
)
6767

src/main/kotlin/io/appwrite/enums/CreditCard.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ enum class CreditCard(val value: String) {
99
ARGENCARD("argencard"),
1010
@SerializedName("cabal")
1111
CABAL("cabal"),
12-
@SerializedName("censosud")
13-
CONSOSUD("censosud"),
12+
@SerializedName("cencosud")
13+
CENCOSUD("cencosud"),
1414
@SerializedName("diners")
1515
DINERS_CLUB("diners"),
1616
@SerializedName("discover")

src/main/kotlin/io/appwrite/enums/Flag.kt

+2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ enum class Flag(val value: String) {
285285
PAPUA_NEW_GUINEA("pg"),
286286
@SerializedName("pl")
287287
POLAND("pl"),
288+
@SerializedName("pf")
289+
FRENCH_POLYNESIA("pf"),
288290
@SerializedName("kp")
289291
NORTH_KOREA("kp"),
290292
@SerializedName("pt")

src/main/kotlin/io/appwrite/enums/Runtime.kt

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ enum class Runtime(val value: String) {
4141
PYTHON_3_11("python-3.11"),
4242
@SerializedName("python-3.12")
4343
PYTHON_3_12("python-3.12"),
44+
@SerializedName("python-ml-3.11")
45+
PYTHON_ML_3_11("python-ml-3.11"),
4446
@SerializedName("deno-1.40")
4547
DENO_1_40("deno-1.40"),
4648
@SerializedName("dart-2.15")

src/main/kotlin/io/appwrite/models/MfaFactors.kt

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,35 @@ import io.appwrite.extensions.jsonCast
88
*/
99
data class MfaFactors(
1010
/**
11-
* TOTP
11+
* Can TOTP be used for MFA challenge for this account.
1212
*/
1313
@SerializedName("totp")
1414
val totp: Boolean,
1515

1616
/**
17-
* Phone
17+
* Can phone (SMS) be used for MFA challenge for this account.
1818
*/
1919
@SerializedName("phone")
2020
val phone: Boolean,
2121

2222
/**
23-
* Email
23+
* Can email be used for MFA challenge for this account.
2424
*/
2525
@SerializedName("email")
2626
val email: Boolean,
2727

28+
/**
29+
* Can recovery code be used for MFA challenge for this account.
30+
*/
31+
@SerializedName("recoveryCode")
32+
val recoveryCode: Boolean,
33+
2834
) {
2935
fun toMap(): Map<String, Any> = mapOf(
3036
"totp" to totp as Any,
3137
"phone" to phone as Any,
3238
"email" to email as Any,
39+
"recoveryCode" to recoveryCode as Any,
3340
)
3441

3542
companion object {
@@ -41,6 +48,7 @@ data class MfaFactors(
4148
totp = map["totp"] as Boolean,
4249
phone = map["phone"] as Boolean,
4350
email = map["email"] as Boolean,
51+
recoveryCode = map["recoveryCode"] as Boolean,
4452
)
4553
}
4654
}

src/main/kotlin/io/appwrite/models/Session.kt

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ data class Session(
1919
@SerializedName("\$createdAt")
2020
val createdAt: String,
2121

22+
/**
23+
* Session update date in ISO 8601 format.
24+
*/
25+
@SerializedName("\$updatedAt")
26+
val updatedAt: String,
27+
2228
/**
2329
* User ID.
2430
*/
@@ -179,6 +185,7 @@ data class Session(
179185
fun toMap(): Map<String, Any> = mapOf(
180186
"\$id" to id as Any,
181187
"\$createdAt" to createdAt as Any,
188+
"\$updatedAt" to updatedAt as Any,
182189
"userId" to userId as Any,
183190
"expire" to expire as Any,
184191
"provider" to provider as Any,
@@ -215,6 +222,7 @@ data class Session(
215222
) = Session(
216223
id = map["\$id"] as String,
217224
createdAt = map["\$createdAt"] as String,
225+
updatedAt = map["\$updatedAt"] as String,
218226
userId = map["userId"] as String,
219227
expire = map["expire"] as String,
220228
provider = map["provider"] as String,

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

+7-31
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class Account(client: Client) : Service(client) {
363363
/**
364364
* Add Authenticator
365365
*
366-
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) method.
366+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
367367
*
368368
* @param type Type of authenticator. Must be `totp`
369369
* @return [io.appwrite.models.MfaType]
@@ -396,7 +396,7 @@ class Account(client: Client) : Service(client) {
396396
/**
397397
* Verify Authenticator
398398
*
399-
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.
399+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add
400400
*
401401
* @param type Type of authenticator.
402402
* @param otp Valid verification token.
@@ -433,7 +433,7 @@ class Account(client: Client) : Service(client) {
433433
/**
434434
* Verify Authenticator
435435
*
436-
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.
436+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add
437437
*
438438
* @param type Type of authenticator.
439439
* @param otp Valid verification token.
@@ -456,14 +456,13 @@ class Account(client: Client) : Service(client) {
456456
*
457457
* @param type Type of authenticator.
458458
* @param otp Valid verification token.
459-
* @return [io.appwrite.models.User<T>]
459+
* @return [Any]
460460
*/
461461
@Throws(AppwriteException::class)
462-
suspend fun <T> deleteMfaAuthenticator(
462+
suspend fun deleteMfaAuthenticator(
463463
type: io.appwrite.enums.AuthenticatorType,
464464
otp: String,
465-
nestedType: Class<T>,
466-
): io.appwrite.models.User<T> {
465+
): Any {
467466
val apiPath = "/account/mfa/authenticators/{type}"
468467
.replace("{type}", type.value)
469468

@@ -473,38 +472,15 @@ class Account(client: Client) : Service(client) {
473472
val apiHeaders = mutableMapOf(
474473
"content-type" to "application/json",
475474
)
476-
val converter: (Any) -> io.appwrite.models.User<T> = {
477-
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
478-
}
479475
return client.call(
480476
"DELETE",
481477
apiPath,
482478
apiHeaders,
483479
apiParams,
484-
responseType = classOf(),
485-
converter,
480+
responseType = Any::class.java,
486481
)
487482
}
488483

489-
/**
490-
* Delete Authenticator
491-
*
492-
* Delete an authenticator for a user by ID.
493-
*
494-
* @param type Type of authenticator.
495-
* @param otp Valid verification token.
496-
* @return [io.appwrite.models.User<T>]
497-
*/
498-
@Throws(AppwriteException::class)
499-
suspend fun deleteMfaAuthenticator(
500-
type: io.appwrite.enums.AuthenticatorType,
501-
otp: String,
502-
): io.appwrite.models.User<Map<String, Any>> = deleteMfaAuthenticator(
503-
type,
504-
otp,
505-
nestedType = classOf(),
506-
)
507-
508484
/**
509485
* Create 2FA Challenge
510486
*

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Avatars(client: Client) : Service(client) {
5858
*
5959
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.
6060
*
61-
* @param code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
61+
* @param code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
6262
* @param width Image width. Pass an integer between 0 to 2000. Defaults to 100.
6363
* @param height Image height. Pass an integer between 0 to 2000. Defaults to 100.
6464
* @param quality Image quality. Pass an integer between 0 to 100. Defaults to 100.

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Messaging(client: Client) : Service(client) {
6363
* @param targets List of Targets IDs.
6464
* @param cc Array of target IDs to be added as CC.
6565
* @param bcc Array of target IDs to be added as BCC.
66-
* @param attachments Array of compound bucket IDs to file IDs to be attached to the email.
66+
* @param attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.
6767
* @param draft Is message a draft
6868
* @param html Is content of type HTML
6969
* @param scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
@@ -133,6 +133,7 @@ class Messaging(client: Client) : Service(client) {
133133
* @param cc Array of target IDs to be added as CC.
134134
* @param bcc Array of target IDs to be added as BCC.
135135
* @param scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
136+
* @param attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.
136137
* @return [io.appwrite.models.Message]
137138
*/
138139
@JvmOverloads
@@ -149,6 +150,7 @@ class Messaging(client: Client) : Service(client) {
149150
cc: List<String>? = null,
150151
bcc: List<String>? = null,
151152
scheduledAt: String? = null,
153+
attachments: List<String>? = null,
152154
): io.appwrite.models.Message {
153155
val apiPath = "/messaging/messages/email/{messageId}"
154156
.replace("{messageId}", messageId)
@@ -164,6 +166,7 @@ class Messaging(client: Client) : Service(client) {
164166
"cc" to cc,
165167
"bcc" to bcc,
166168
"scheduledAt" to scheduledAt,
169+
"attachments" to attachments,
167170
)
168171
val apiHeaders = mutableMapOf(
169172
"content-type" to "application/json",
@@ -194,7 +197,7 @@ class Messaging(client: Client) : Service(client) {
194197
* @param targets List of Targets IDs.
195198
* @param data Additional Data for push notification.
196199
* @param action Action for push notification.
197-
* @param image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
200+
* @param image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.
198201
* @param icon Icon for push notification. Available only for Android and Web Platform.
199202
* @param sound Sound for push notification. Available only for Android and IOS Platform.
200203
* @param color Color for push notification. Available only for Android Platform.
@@ -273,7 +276,7 @@ class Messaging(client: Client) : Service(client) {
273276
* @param body Body for push notification.
274277
* @param data Additional Data for push notification.
275278
* @param action Action for push notification.
276-
* @param image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
279+
* @param image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.
277280
* @param icon Icon for push notification. Available only for Android and Web platforms.
278281
* @param sound Sound for push notification. Available only for Android and iOS platforms.
279282
* @param color Color for push notification. Available only for Android platforms.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ class Users(client: Client) : Service(client) {
19221922
/**
19231923
* Create token
19241924
*
1925-
* Returns a token with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) endpoint to complete the login process.
1925+
* Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
19261926
*
19271927
* @param userId User ID.
19281928
* @param length Token length in characters. The default length is 6 characters

0 commit comments

Comments
 (0)