Skip to content

Commit 3f59fbc

Browse files
authored
Merge pull request #36 from appwrite/dev
Dev
2 parents 103ffe6 + 5eb1e71 commit 3f59fbc

File tree

566 files changed

+11194
-1238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

566 files changed

+11194
-1238
lines changed

.github/workflows/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
steps:
1313
- name: Check out code
1414
uses: actions/checkout@v2
15-
- name: Set up JDK 11
15+
- name: Set up JDK 17
1616
uses: actions/setup-java@v1
1717
with:
18-
java-version: 11
18+
java-version: 17
1919
# Base64 decodes and pipes the GPG key content into the secret file
2020
- name: Prepare environment
2121
env:
@@ -35,7 +35,7 @@ jobs:
3535
# Runs upload, and then closes & releases the repository
3636
- name: Publish Release Version to MavenCentral
3737
run: |
38-
if ${{ endswith(github.event.release.tag_name, '-SNAPSHOT') }}; then
38+
if ${{ contains(github.event.release.tag_name, '-rc') }}; then
3939
echo "Publising Snapshot Version ${{ github.event.release.tag_name}} to Snapshot repository"
4040
./gradlew publishToSonatype
4141
else

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
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.4.12-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.5.0-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

9-
**This SDK is compatible with Appwrite server version 1.4.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 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).**
1010

1111
> This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)
1212
1313
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)
1414

15-
![Appwrite](https://appwrite.io/images/github.png)
15+
![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)
1616

1717
## Installation
1818

@@ -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:4.1.0")
42+
implementation("io.appwrite:sdk-for-kotlin:5.0.0")
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>4.1.0</version>
53+
<version>5.0.0</version>
5454
</dependency>
5555
</dependencies>
5656
```
@@ -84,7 +84,9 @@ val users = Users(client)
8484
val user = users.create(
8585
user = ID.unique(),
8686
email = "[email protected]",
87+
phone = "+123456789",
8788
password = "password",
89+
name = "Walter O'Brien"
8890
)
8991
```
9092

@@ -106,7 +108,9 @@ suspend fun main() {
106108
val user = users.create(
107109
user = ID.unique(),
108110
email = "[email protected]",
111+
phone = "+123456789",
109112
password = "password",
113+
name = "Walter O'Brien"
110114
)
111115
}
112116
```
@@ -126,7 +130,9 @@ suspend fun main() {
126130
val user = users.create(
127131
user = ID.unique(),
128132
email = "[email protected]",
133+
phone = "+123456789",
129134
password = "password",
135+
name = "Walter O'Brien"
130136
)
131137
} catch (e: AppwriteException) {
132138
e.printStackTrace()

build.gradle

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
2-
id "org.jetbrains.kotlin.jvm" version '1.8.0'
2+
id "org.jetbrains.kotlin.jvm" version '1.9.10'
33
id "java-library"
4-
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
4+
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
55
}
66

77
apply from: "${rootDir}/scripts/configure.gradle"
@@ -29,14 +29,16 @@ repositories {
2929
}
3030

3131
dependencies {
32-
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
33-
api(platform("com.squareup.okhttp3:okhttp-bom:4.9.3"))
32+
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
33+
34+
api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
3435
api("com.squareup.okhttp3:okhttp")
36+
3537
implementation("com.squareup.okhttp3:okhttp-urlconnection")
3638
implementation("com.squareup.okhttp3:logging-interceptor")
3739
implementation("com.google.code.gson:gson:2.9.0")
3840

39-
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
41+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
4042
}
4143

4244
test {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2"); // Your project ID
8+
9+
Account account = new Account(client);
10+
11+
account.createAnonymousSession(new CoroutineCallback<>((result, error) -> {
12+
if (error != null) {
13+
error.printStackTrace();
14+
return;
15+
}
16+
17+
System.out.println(result);
18+
}));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2"); // Your project ID
8+
9+
Account account = new Account(client);
10+
11+
account.createEmailPasswordSession(
12+
"[email protected]", // email
13+
"password", // password
14+
new CoroutineCallback<>((result, error) -> {
15+
if (error != null) {
16+
error.printStackTrace();
17+
return;
18+
}
19+
20+
System.out.println(result);
21+
})
22+
);
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2"); // Your project ID
8+
9+
Account account = new Account(client);
10+
11+
account.createEmailToken(
12+
"<USER_ID>", // userId
13+
"[email protected]", // email
14+
false, // phrase (optional)
15+
new CoroutineCallback<>((result, error) -> {
16+
if (error != null) {
17+
error.printStackTrace();
18+
return;
19+
}
20+
21+
System.out.println(result);
22+
})
23+
);
24+
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2"); // Your project ID
8+
9+
Account account = new Account(client);
10+
11+
account.createJWT(new CoroutineCallback<>((result, error) -> {
12+
if (error != null) {
13+
error.printStackTrace();
14+
return;
15+
}
16+
17+
System.out.println(result);
18+
}));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2"); // Your project ID
8+
9+
Account account = new Account(client);
10+
11+
account.createMagicURLToken(
12+
"<USER_ID>", // userId
13+
"[email protected]", // email
14+
"https://example.com", // url (optional)
15+
false, // phrase (optional)
16+
new CoroutineCallback<>((result, error) -> {
17+
if (error != null) {
18+
error.printStackTrace();
19+
return;
20+
}
21+
22+
System.out.println(result);
23+
})
24+
);
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
import io.appwrite.enums.AuthenticatorType;
5+
6+
Client client = new Client()
7+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
8+
.setProject("5df5acd0d48c2") // Your project ID
9+
.setSession(""); // The user session to authenticate with
10+
11+
Account account = new Account(client);
12+
13+
account.createMfaAuthenticator(
14+
AuthenticatorType.TOTP, // type
15+
new CoroutineCallback<>((result, error) -> {
16+
if (error != null) {
17+
error.printStackTrace();
18+
return;
19+
}
20+
21+
System.out.println(result);
22+
})
23+
);
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
import io.appwrite.enums.AuthenticationFactor;
5+
6+
Client client = new Client()
7+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
8+
.setProject("5df5acd0d48c2"); // Your project ID
9+
10+
Account account = new Account(client);
11+
12+
account.createMfaChallenge(
13+
AuthenticationFactor.EMAIL, // factor
14+
new CoroutineCallback<>((result, error) -> {
15+
if (error != null) {
16+
error.printStackTrace();
17+
return;
18+
}
19+
20+
System.out.println(result);
21+
})
22+
);
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setSession(""); // The user session to authenticate with
9+
10+
Account account = new Account(client);
11+
12+
account.createMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> {
13+
if (error != null) {
14+
error.printStackTrace();
15+
return;
16+
}
17+
18+
System.out.println(result);
19+
}));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
import io.appwrite.enums.OAuthProvider;
5+
6+
Client client = new Client()
7+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
8+
.setProject("5df5acd0d48c2"); // Your project ID
9+
10+
Account account = new Account(client);
11+
12+
account.createOAuth2Token(
13+
OAuthProvider.AMAZON, // provider
14+
"https://example.com", // success (optional)
15+
"https://example.com", // failure (optional)
16+
listOf(), // scopes (optional)
17+
new CoroutineCallback<>((result, error) -> {
18+
if (error != null) {
19+
error.printStackTrace();
20+
return;
21+
}
22+
23+
System.out.println(result);
24+
})
25+
);
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Account;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2"); // Your project ID
8+
9+
Account account = new Account(client);
10+
11+
account.createPhoneToken(
12+
"<USER_ID>", // userId
13+
"+12065550100", // phone
14+
new CoroutineCallback<>((result, error) -> {
15+
if (error != null) {
16+
error.printStackTrace();
17+
return;
18+
}
19+
20+
System.out.println(result);
21+
})
22+
);
23+

docs/examples/java/account/create-phone-verification.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import io.appwrite.services.Account;
55
Client client = new Client()
66
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
77
.setProject("5df5acd0d48c2") // Your project ID
8-
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
8+
.setSession(""); // The user session to authenticate with
99

1010
Account account = new Account(client);
1111

docs/examples/java/account/create-recovery.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import io.appwrite.services.Account;
55
Client client = new Client()
66
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
77
.setProject("5df5acd0d48c2") // Your project ID
8-
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
8+
.setSession(""); // The user session to authenticate with
99

1010
Account account = new Account(client);
1111

1212
account.createRecovery(
13-
14-
"https://example.com"
13+
"[email protected]", // email
14+
"https://example.com", // url
1515
new CoroutineCallback<>((result, error) -> {
1616
if (error != null) {
1717
error.printStackTrace();
@@ -21,3 +21,4 @@ account.createRecovery(
2121
System.out.println(result);
2222
})
2323
);
24+

0 commit comments

Comments
 (0)