Skip to content

Commit c8c24fa

Browse files
committed
Update for 1.0.0
1 parent 5764714 commit c8c24fa

40 files changed

+692
-84
lines changed

README.md

+13-15
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
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.0.0-RC1-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.0.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.0.0-RC1. 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.0.0. 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
@@ -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:1.0.0-SNAPSHOT")
42+
implementation("io.appwrite:sdk-for-kotlin:1.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>1.0.0-SNAPSHOT</version>
53+
<version>1.0.0</version>
5454
</dependency>
5555
</dependencies>
5656
```
@@ -81,19 +81,19 @@ Once your SDK object is set, create any of the Appwrite service objects and choo
8181

8282
```kotlin
8383
val users = Users(client)
84-
val response = users.create(
85-
user = "[USER_ID]",
84+
val user = users.create(
85+
user = ID.unique(),
8686
email = "[email protected]",
8787
password = "password",
8888
)
89-
val json = response.body?.string()
9089
```
9190

9291
### Full Example
9392

9493
```kotlin
9594
import io.appwrite.Client
9695
import io.appwrite.services.Users
96+
import io.appwrite.ID
9797

9898
suspend fun main() {
9999
val client = Client(context)
@@ -103,12 +103,11 @@ suspend fun main() {
103103
.setSelfSigned(true) // Use only on dev mode with a self-signed SSL cert
104104

105105
val users = Users(client)
106-
val response = users.create(
107-
user = "[USER_ID]",
106+
val user = users.create(
107+
user = ID.unique(),
108108
email = "[email protected]",
109109
password = "password",
110110
)
111-
val json = response.body?.string()
112111
}
113112
```
114113

@@ -118,20 +117,19 @@ The Appwrite Kotlin SDK raises `AppwriteException` object with `message`, `code`
118117

119118
```kotlin
120119
import io.appwrite.Client
120+
import io.appwrite.ID
121121
import io.appwrite.services.Users
122122

123123
suspend fun main() {
124124
val users = Users(client)
125125
try {
126-
val response = users.create(
127-
user = "[USER_ID]",
126+
val user = users.create(
127+
user = ID.unique(),
128128
email = "[email protected]",
129129
password = "password",
130130
)
131-
var jsonString = response.body?.string() ?: ""
132-
133131
} catch (e: AppwriteException) {
134-
println(e)
132+
e.printStackTrace()
135133
}
136134
}
137135
```
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Account
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
9+
10+
Account account = new Account(client);
11+
account.listLogs(
12+
new Continuation<Response>() {
13+
@NotNull
14+
@Override
15+
public CoroutineContext getContext() {
16+
return EmptyCoroutineContext.INSTANCE;
17+
}
18+
19+
@Override
20+
public void resumeWith(@NotNull Object o) {
21+
String json = "";
22+
try {
23+
if (o instanceof Result.Failure) {
24+
Result.Failure failure = (Result.Failure) o;
25+
throw failure.exception;
26+
} else {
27+
Response response = (Response) o;
28+
}
29+
} catch (Throwable th) {
30+
Log.e("ERROR", th.toString());
31+
}
32+
}
33+
}
34+
);
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Account
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
9+
10+
Account account = new Account(client);
11+
account.listSessions(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}

docs/examples/java/functions/list-variables.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public void main() {
99

1010
Functions functions = new Functions(client);
1111
functions.listVariables(
12-
functionId = "[FUNCTION_ID]",
12+
functionId = "[FUNCTION_ID]"
1313
new Continuation<Response>() {
1414
@NotNull
1515
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Locale
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
9+
10+
Locale locale = new Locale(client);
11+
locale.listContinents(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Locale
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
9+
10+
Locale locale = new Locale(client);
11+
locale.listCountriesEU(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Locale
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
9+
10+
Locale locale = new Locale(client);
11+
locale.listCountriesPhones(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Locale
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
9+
10+
Locale locale = new Locale(client);
11+
locale.listCountries(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Locale
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
9+
10+
Locale locale = new Locale(client);
11+
locale.listCurrencies(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Locale
3+
4+
public void main() {
5+
Client client = Client(context)
6+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
7+
.setProject("5df5acd0d48c2") // Your project ID
8+
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
9+
10+
Locale locale = new Locale(client);
11+
locale.listLanguages(new Continuation<Response>() {
12+
@NotNull
13+
@Override
14+
public CoroutineContext getContext() {
15+
return EmptyCoroutineContext.INSTANCE;
16+
}
17+
18+
@Override
19+
public void resumeWith(@NotNull Object o) {
20+
String json = "";
21+
try {
22+
if (o instanceof Result.Failure) {
23+
Result.Failure failure = (Result.Failure) o;
24+
throw failure.exception;
25+
} else {
26+
Response response = (Response) o;
27+
}
28+
} catch (Throwable th) {
29+
Log.e("ERROR", th.toString());
30+
}
31+
}
32+
});
33+
}

0 commit comments

Comments
 (0)