Skip to content

Commit 6adf4ef

Browse files
feat: support for 0.13.0
1 parent 1cec45c commit 6adf4ef

Some content is hidden

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

86 files changed

+1830
-725
lines changed

README.md

Lines changed: 2 additions & 2 deletions
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-0.12.1-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-0.13.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 0.12.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 0.13.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

build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm' version '1.5.31'
3-
id 'java-library'
2+
id "org.jetbrains.kotlin.jvm" version '1.5.31'
3+
id "java-library"
4+
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
45
}
56

7+
apply from: "${rootDir}/scripts/configure.gradle"
8+
69
ext {
710
PUBLISH_GROUP_ID = 'io.appwrite'
811
PUBLISH_ARTIFACT_ID = 'sdk-for-kotlin'
9-
PUBLISH_VERSION = '0.2.5'
12+
PUBLISH_VERSION = System.getenv('SDK_VERSION')
1013
POM_URL = 'https://github.com/appwrite/sdk-for-kotlin'
1114
POM_SCM_URL = 'https://github.com/appwrite/sdk-for-kotlin'
1215
POM_ISSUE_URL = 'https://github.com/appwrite/sdk-for-kotlin/issues'
@@ -41,6 +44,7 @@ test {
4144
}
4245

4346
compileKotlin {
47+
dependsOn createBuildConfig
4448
kotlinOptions.jvmTarget = '1.8'
4549
}
4650

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.updateSession(
12+
sessionId = "[SESSION_ID]"
13+
new Continuation<Response>() {
14+
@NotNull
15+
@Override
16+
public CoroutineContext getContext() {
17+
return EmptyCoroutineContext.INSTANCE;
18+
}
19+
20+
@Override
21+
public void resumeWith(@NotNull Object o) {
22+
String json = "";
23+
try {
24+
if (o instanceof Result.Failure) {
25+
Result.Failure failure = (Result.Failure) o;
26+
throw failure.exception;
27+
} else {
28+
Response response = (Response) o;
29+
}
30+
} catch (Throwable th) {
31+
Log.e("ERROR", th.toString());
32+
}
33+
}
34+
}
35+
);
36+
}

docs/examples/java/functions/create-tag.md renamed to docs/examples/java/functions/create-deployment.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ public void main() {
88
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
99

1010
Functions functions = new Functions(client);
11-
functions.createTag(
11+
functions.createDeployment(
1212
functionId = "[FUNCTION_ID]",
13-
command = "[COMMAND]",
14-
code = File("./path-to-files/image.jpg")
13+
entrypoint = "[ENTRYPOINT]",
14+
code = File("./path-to-files/image.jpg"),
15+
activate = false
1516
new Continuation<Response>() {
1617
@NotNull
1718
@Override

docs/examples/java/functions/delete-tag.md renamed to docs/examples/java/functions/delete-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public void main() {
88
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
99

1010
Functions functions = new Functions(client);
11-
functions.deleteTag(
11+
functions.deleteDeployment(
1212
functionId = "[FUNCTION_ID]",
13-
tagId = "[TAG_ID]"
13+
deploymentId = "[DEPLOYMENT_ID]"
1414
new Continuation<Response>() {
1515
@NotNull
1616
@Override

docs/examples/java/functions/update-tag.md renamed to docs/examples/java/functions/get-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public void main() {
88
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
99

1010
Functions functions = new Functions(client);
11-
functions.updateTag(
11+
functions.getDeployment(
1212
functionId = "[FUNCTION_ID]",
13-
tag = "[TAG]"
13+
deploymentId = "[DEPLOYMENT_ID]"
1414
new Continuation<Response>() {
1515
@NotNull
1616
@Override

docs/examples/java/functions/list-tags.md renamed to docs/examples/java/functions/list-deployments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public void main() {
88
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
99

1010
Functions functions = new Functions(client);
11-
functions.listTags(
11+
functions.listDeployments(
1212
functionId = "[FUNCTION_ID]",
1313
new Continuation<Response>() {
1414
@NotNull
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Functions
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+
Functions functions = new Functions(client);
11+
functions.retryBuild(
12+
functionId = "[FUNCTION_ID]",
13+
deploymentId = "[DEPLOYMENT_ID]",
14+
buildId = "[BUILD_ID]"
15+
new Continuation<Response>() {
16+
@NotNull
17+
@Override
18+
public CoroutineContext getContext() {
19+
return EmptyCoroutineContext.INSTANCE;
20+
}
21+
22+
@Override
23+
public void resumeWith(@NotNull Object o) {
24+
String json = "";
25+
try {
26+
if (o instanceof Result.Failure) {
27+
Result.Failure failure = (Result.Failure) o;
28+
throw failure.exception;
29+
} else {
30+
Response response = (Response) o;
31+
}
32+
} catch (Throwable th) {
33+
Log.e("ERROR", th.toString());
34+
}
35+
}
36+
}
37+
);
38+
}

docs/examples/java/functions/get-tag.md renamed to docs/examples/java/functions/update-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public void main() {
88
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
99

1010
Functions functions = new Functions(client);
11-
functions.getTag(
11+
functions.updateDeployment(
1212
functionId = "[FUNCTION_ID]",
13-
tagId = "[TAG_ID]"
13+
deploymentId = "[DEPLOYMENT_ID]"
1414
new Continuation<Response>() {
1515
@NotNull
1616
@Override
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Storage
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+
Storage storage = new Storage(client);
11+
storage.createBucket(
12+
bucketId = "[BUCKET_ID]",
13+
name = "[NAME]",
14+
permission = "file",
15+
new Continuation<Response>() {
16+
@NotNull
17+
@Override
18+
public CoroutineContext getContext() {
19+
return EmptyCoroutineContext.INSTANCE;
20+
}
21+
22+
@Override
23+
public void resumeWith(@NotNull Object o) {
24+
String json = "";
25+
try {
26+
if (o instanceof Result.Failure) {
27+
Result.Failure failure = (Result.Failure) o;
28+
throw failure.exception;
29+
} else {
30+
Response response = (Response) o;
31+
}
32+
} catch (Throwable th) {
33+
Log.e("ERROR", th.toString());
34+
}
35+
}
36+
}
37+
);
38+
}

docs/examples/java/storage/create-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.createFile(
12+
bucketId = "[BUCKET_ID]",
1213
fileId = "[FILE_ID]",
1314
file = File("./path-to-files/image.jpg"),
1415
new Continuation<Response>() {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Storage
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+
Storage storage = new Storage(client);
11+
storage.deleteBucket(
12+
bucketId = "[BUCKET_ID]"
13+
new Continuation<Response>() {
14+
@NotNull
15+
@Override
16+
public CoroutineContext getContext() {
17+
return EmptyCoroutineContext.INSTANCE;
18+
}
19+
20+
@Override
21+
public void resumeWith(@NotNull Object o) {
22+
String json = "";
23+
try {
24+
if (o instanceof Result.Failure) {
25+
Result.Failure failure = (Result.Failure) o;
26+
throw failure.exception;
27+
} else {
28+
Response response = (Response) o;
29+
}
30+
} catch (Throwable th) {
31+
Log.e("ERROR", th.toString());
32+
}
33+
}
34+
}
35+
);
36+
}

docs/examples/java/storage/delete-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.deleteFile(
12+
bucketId = "[BUCKET_ID]",
1213
fileId = "[FILE_ID]"
1314
new Continuation<Response>() {
1415
@NotNull
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Storage
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+
Storage storage = new Storage(client);
11+
storage.getBucket(
12+
bucketId = "[BUCKET_ID]"
13+
new Continuation<Response>() {
14+
@NotNull
15+
@Override
16+
public CoroutineContext getContext() {
17+
return EmptyCoroutineContext.INSTANCE;
18+
}
19+
20+
@Override
21+
public void resumeWith(@NotNull Object o) {
22+
String json = "";
23+
try {
24+
if (o instanceof Result.Failure) {
25+
Result.Failure failure = (Result.Failure) o;
26+
throw failure.exception;
27+
} else {
28+
Response response = (Response) o;
29+
}
30+
} catch (Throwable th) {
31+
Log.e("ERROR", th.toString());
32+
}
33+
}
34+
}
35+
);
36+
}

docs/examples/java/storage/get-file-download.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.getFileDownload(
12+
bucketId = "[BUCKET_ID]",
1213
fileId = "[FILE_ID]"
1314
new Continuation<Response>() {
1415
@NotNull

docs/examples/java/storage/get-file-preview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.getFilePreview(
12+
bucketId = "[BUCKET_ID]",
1213
fileId = "[FILE_ID]",
1314
new Continuation<Response>() {
1415
@NotNull

docs/examples/java/storage/get-file-view.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.getFileView(
12+
bucketId = "[BUCKET_ID]",
1213
fileId = "[FILE_ID]"
1314
new Continuation<Response>() {
1415
@NotNull

docs/examples/java/storage/get-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.getFile(
12+
bucketId = "[BUCKET_ID]",
1213
fileId = "[FILE_ID]"
1314
new Continuation<Response>() {
1415
@NotNull
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import io.appwrite.Client
2+
import io.appwrite.services.Storage
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+
Storage storage = new Storage(client);
11+
storage.listBuckets(
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+
}

docs/examples/java/storage/list-files.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void main() {
99

1010
Storage storage = new Storage(client);
1111
storage.listFiles(
12+
bucketId = "[BUCKET_ID]",
1213
new Continuation<Response>() {
1314
@NotNull
1415
@Override

0 commit comments

Comments
 (0)