Skip to content

Commit 42f7c02

Browse files
committed
Release candidate for 1.5.x
1 parent 85d50f1 commit 42f7c02

25 files changed

+112
-144
lines changed

README.md

Lines changed: 2 additions & 2 deletions
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:5.0.0-rc.5")
42+
implementation("io.appwrite:sdk-for-kotlin:5.0.0-rc.6")
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.0-rc.5</version>
53+
<version>5.0.0-rc.6</version>
5454
</dependency>
5555
</dependencies>
5656
```

docs/examples/java/account/create-o-auth2session.md renamed to docs/examples/java/account/update-phone-session.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import io.appwrite.Client;
22
import io.appwrite.coroutines.CoroutineCallback;
33
import io.appwrite.services.Account;
4-
import io.appwrite.enums.OAuthProvider;
54

65
Client client = new Client()
76
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
87
.setProject("5df5acd0d48c2"); // Your project ID
98

109
Account account = new Account(client);
1110

12-
account.createOAuth2Session(
13-
OAuthProvider.AMAZON, // provider
14-
"https://example.com", // success (optional)
15-
"https://example.com", // failure (optional)
16-
listOf(), // scopes (optional)
11+
account.updatePhoneSession(
12+
"<USER_ID>", // userId
13+
"<SECRET>", // secret
1714
new CoroutineCallback<>((result, error) -> {
1815
if (error != null) {
1916
error.printStackTrace();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ messaging.createEmail(
1919
listOf(), // cc (optional)
2020
listOf(), // bcc (optional)
2121
listOf(), // attachments (optional)
22-
MessageStatus.DRAFT, // status (optional)
22+
false, // draft (optional)
2323
false, // html (optional)
2424
"", // scheduledAt (optional)
2525
new CoroutineCallback<>((result, error) -> {

docs/examples/java/messaging/create-push.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ messaging.createPush(
2424
"<COLOR>", // color (optional)
2525
"<TAG>", // tag (optional)
2626
"<BADGE>", // badge (optional)
27-
MessageStatus.DRAFT, // status (optional)
27+
false, // draft (optional)
2828
"", // scheduledAt (optional)
2929
new CoroutineCallback<>((result, error) -> {
3030
if (error != null) {

docs/examples/java/messaging/create-sms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ messaging.createSms(
1515
listOf(), // topics (optional)
1616
listOf(), // users (optional)
1717
listOf(), // targets (optional)
18-
MessageStatus.DRAFT, // status (optional)
18+
false, // draft (optional)
1919
"", // scheduledAt (optional)
2020
new CoroutineCallback<>((result, error) -> {
2121
if (error != null) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ messaging.updateEmail(
1616
listOf(), // targets (optional)
1717
"<SUBJECT>", // subject (optional)
1818
"<CONTENT>", // content (optional)
19-
MessageStatus.DRAFT, // status (optional)
19+
false, // draft (optional)
2020
false, // html (optional)
2121
listOf(), // cc (optional)
2222
listOf(), // bcc (optional)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ messaging.updatePush(
2424
"<COLOR>", // color (optional)
2525
"<TAG>", // tag (optional)
2626
0, // badge (optional)
27-
MessageStatus.DRAFT, // status (optional)
27+
false, // draft (optional)
2828
"", // scheduledAt (optional)
2929
new CoroutineCallback<>((result, error) -> {
3030
if (error != null) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ messaging.updateSms(
1515
listOf(), // users (optional)
1616
listOf(), // targets (optional)
1717
"<CONTENT>", // content (optional)
18-
MessageStatus.DRAFT, // status (optional)
18+
false, // draft (optional)
1919
"", // scheduledAt (optional)
2020
new CoroutineCallback<>((result, error) -> {
2121
if (error != null) {

docs/examples/java/users/delete-authenticator.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Users users = new Users(client);
1313
users.deleteAuthenticator(
1414
"<USER_ID>", // userId
1515
AuthenticatorType.TOTP, // type
16-
"<OTP>", // otp
1716
new CoroutineCallback<>((result, error) -> {
1817
if (error != null) {
1918
error.printStackTrace();
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import io.appwrite.Client
22
import io.appwrite.coroutines.CoroutineCallback
33
import io.appwrite.services.Account
4-
import io.appwrite.enums.OAuthProvider
54

65
val client = Client()
76
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
87
.setProject("5df5acd0d48c2") // Your project ID
98

109
val account = Account(client)
1110

12-
account.createOAuth2Session(
13-
provider = OAuthProvider.AMAZON,
14-
success = "https://example.com", // optional
15-
failure = "https://example.com", // optional
16-
scopes = listOf() // optional
11+
val response = account.updatePhoneSession(
12+
userId = "<USER_ID>",
13+
secret = "<SECRET>"
1714
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ val response = messaging.createEmail(
1919
cc = listOf(), // optional
2020
bcc = listOf(), // optional
2121
attachments = listOf(), // optional
22-
status = "draft", // optional
22+
draft = false, // optional
2323
html = false, // optional
2424
scheduledAt = "" // optional
2525
)

docs/examples/kotlin/messaging/create-push.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ val response = messaging.createPush(
2424
color = "<COLOR>", // optional
2525
tag = "<TAG>", // optional
2626
badge = "<BADGE>", // optional
27-
status = "draft", // optional
27+
draft = false, // optional
2828
scheduledAt = "" // optional
2929
)

docs/examples/kotlin/messaging/create-sms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ val response = messaging.createSms(
1515
topics = listOf(), // optional
1616
users = listOf(), // optional
1717
targets = listOf(), // optional
18-
status = "draft", // optional
18+
draft = false, // optional
1919
scheduledAt = "" // optional
2020
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ val response = messaging.updateEmail(
1616
targets = listOf(), // optional
1717
subject = "<SUBJECT>", // optional
1818
content = "<CONTENT>", // optional
19-
status = "draft", // optional
19+
draft = false, // optional
2020
html = false, // optional
2121
cc = listOf(), // optional
2222
bcc = listOf(), // optional

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ val response = messaging.updatePush(
2424
color = "<COLOR>", // optional
2525
tag = "<TAG>", // optional
2626
badge = 0, // optional
27-
status = "draft", // optional
27+
draft = false, // optional
2828
scheduledAt = "" // optional
2929
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ val response = messaging.updateSms(
1515
users = listOf(), // optional
1616
targets = listOf(), // optional
1717
content = "<CONTENT>", // optional
18-
status = "draft", // optional
18+
draft = false, // optional
1919
scheduledAt = "" // optional
2020
)

docs/examples/kotlin/users/delete-authenticator.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ val users = Users(client)
1212

1313
val response = users.deleteAuthenticator(
1414
userId = "<USER_ID>",
15-
type = AuthenticatorType.TOTP,
16-
otp = "<OTP>"
15+
type = AuthenticatorType.TOTP
1716
)

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

Lines changed: 2 additions & 2 deletions
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.0-rc.5 ${System.getProperty("http.agent")}",
60+
"user-agent" to "AppwriteKotlinSDK/5.0.0-rc.6 ${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.0-rc.5", "x-appwrite-response-format" to "1.5.0"
64+
"x-sdk-version" to "5.0.0-rc.6", "x-appwrite-response-format" to "1.5.0"
6565
)
6666
config = mutableMapOf()
6767

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ enum class IndexType(val value: String) {
88
@SerializedName("fulltext")
99
FULLTEXT("fulltext"),
1010
@SerializedName("unique")
11-
UNIQUE("unique"),
12-
@SerializedName("spatial")
13-
SPATIAL("spatial");
11+
UNIQUE("unique");
1412

1513
override fun toString() = value
1614
}

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

Lines changed: 0 additions & 14 deletions
This file was deleted.

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

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class Account(client: Client) : Service(client) {
313313
/**
314314
* Update MFA
315315
*
316-
*
316+
* Enable or disable MFA on an account.
317317
*
318318
* @param mfa Enable or disable MFA.
319319
* @return [io.appwrite.models.User<T>]
@@ -347,7 +347,7 @@ class Account(client: Client) : Service(client) {
347347
/**
348348
* Update MFA
349349
*
350-
*
350+
* Enable or disable MFA on an account.
351351
*
352352
* @param mfa Enable or disable MFA.
353353
* @return [io.appwrite.models.User<T>]
@@ -396,7 +396,7 @@ class Account(client: Client) : Service(client) {
396396
/**
397397
* Create MFA Challenge (confirmation)
398398
*
399-
*
399+
* Complete the MFA challenge by providing the one-time password.
400400
*
401401
* @param challengeId ID of the challenge.
402402
* @param otp Valid verification token.
@@ -428,7 +428,7 @@ class Account(client: Client) : Service(client) {
428428
/**
429429
* List Factors
430430
*
431-
*
431+
* List the factors available on the account to be used as a MFA challange.
432432
*
433433
* @return [io.appwrite.models.MfaFactors]
434434
*/
@@ -458,7 +458,7 @@ class Account(client: Client) : Service(client) {
458458
/**
459459
* Add Authenticator
460460
*
461-
*
461+
* 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.
462462
*
463463
* @param type Type of authenticator.
464464
* @return [io.appwrite.models.MfaType]
@@ -491,7 +491,7 @@ class Account(client: Client) : Service(client) {
491491
/**
492492
* Verify Authenticator
493493
*
494-
*
494+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.
495495
*
496496
* @param type Type of authenticator.
497497
* @param otp Valid verification token.
@@ -528,7 +528,7 @@ class Account(client: Client) : Service(client) {
528528
/**
529529
* Verify Authenticator
530530
*
531-
*
531+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.
532532
*
533533
* @param type Type of authenticator.
534534
* @param otp Valid verification token.
@@ -547,7 +547,7 @@ class Account(client: Client) : Service(client) {
547547
/**
548548
* Delete Authenticator
549549
*
550-
*
550+
* Delete an authenticator for a user by ID.
551551
*
552552
* @param type Type of authenticator.
553553
* @param otp Valid verification token.
@@ -584,7 +584,7 @@ class Account(client: Client) : Service(client) {
584584
/**
585585
* Delete Authenticator
586586
*
587-
*
587+
* Delete an authenticator for a user by ID.
588588
*
589589
* @param type Type of authenticator.
590590
* @param otp Valid verification token.
@@ -1056,7 +1056,7 @@ class Account(client: Client) : Service(client) {
10561056
}
10571057

10581058
/**
1059-
* Create session (deprecated)
1059+
* Update magic URL session
10601060
*
10611061
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
10621062
*
@@ -1092,40 +1092,38 @@ class Account(client: Client) : Service(client) {
10921092
}
10931093

10941094
/**
1095-
* Create OAuth2 session
1095+
* Update phone session
10961096
*
1097-
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL&#039;s back to your app when login is completed.If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
1097+
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
10981098
*
1099-
* @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1100-
* @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1101-
* @param failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1102-
* @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
1103-
* @return [String]
1099+
* @param userId User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1100+
* @param secret Valid verification token.
1101+
* @return [io.appwrite.models.Session]
11041102
*/
1105-
@JvmOverloads
11061103
@Throws(AppwriteException::class)
1107-
suspend fun createOAuth2Session(
1108-
provider: OAuthProvider,
1109-
success: String? = null,
1110-
failure: String? = null,
1111-
scopes: List<String>? = null,
1112-
): String {
1113-
val apiPath = "/account/sessions/oauth2/{provider}"
1114-
.replace("{provider}", provider.value)
1104+
suspend fun updatePhoneSession(
1105+
userId: String,
1106+
secret: String,
1107+
): io.appwrite.models.Session {
1108+
val apiPath = "/account/sessions/phone"
11151109

11161110
val apiParams = mutableMapOf<String, Any?>(
1117-
"success" to success,
1118-
"failure" to failure,
1119-
"scopes" to scopes,
1111+
"userId" to userId,
1112+
"secret" to secret,
11201113
)
11211114
val apiHeaders = mutableMapOf(
11221115
"content-type" to "application/json",
11231116
)
1124-
return client.redirect(
1125-
"GET",
1117+
val converter: (Any) -> io.appwrite.models.Session = {
1118+
io.appwrite.models.Session.from(map = it as Map<String, Any>)
1119+
}
1120+
return client.call(
1121+
"PUT",
11261122
apiPath,
11271123
apiHeaders,
1128-
apiParams
1124+
apiParams,
1125+
responseType = io.appwrite.models.Session::class.java,
1126+
converter,
11291127
)
11301128
}
11311129

@@ -1199,7 +1197,7 @@ class Account(client: Client) : Service(client) {
11991197
}
12001198

12011199
/**
1202-
* Update (or renew) a session
1200+
* Update (or renew) session
12031201
*
12041202
* Extend session&#039;s expiry to increase it&#039;s lifespan. Extending a session is useful when session length is short such as 5 minutes.
12051203
*

0 commit comments

Comments
 (0)