Skip to content

Commit 890eaea

Browse files
committed
feat(docs): add updated docs for java and kotlin
1 parent ab3029b commit 890eaea

File tree

122 files changed

+2992
-72
lines changed

Some content is hidden

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

122 files changed

+2992
-72
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.createAnonymousSession(new Continuation<Object>() {
22+
@NotNull
23+
@Override
24+
public CoroutineContext getContext() {
25+
return EmptyCoroutineContext.INSTANCE;
26+
}
27+
28+
@Override
29+
public void resumeWith(@NotNull Object o) {
30+
String json = "";
31+
try {
32+
if (o instanceof Result.Failure) {
33+
Result.Failure failure = (Result.Failure) o;
34+
throw failure.exception;
35+
} else {
36+
Response response = (Response) o;
37+
json = response.body().string();
38+
}
39+
}
40+
} catch (Throwable th) {
41+
Log.e("ERROR", th.toString());
42+
}
43+
}
44+
});
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.createJWT(new Continuation<Object>() {
22+
@NotNull
23+
@Override
24+
public CoroutineContext getContext() {
25+
return EmptyCoroutineContext.INSTANCE;
26+
}
27+
28+
@Override
29+
public void resumeWith(@NotNull Object o) {
30+
String json = "";
31+
try {
32+
if (o instanceof Result.Failure) {
33+
Result.Failure failure = (Result.Failure) o;
34+
throw failure.exception;
35+
} else {
36+
Response response = (Response) o;
37+
json = response.body().string();
38+
}
39+
}
40+
} catch (Throwable th) {
41+
Log.e("ERROR", th.toString());
42+
}
43+
}
44+
});
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.createOAuth2Session(
22+
this,
23+
"amazon",
24+
new Continuation<Object>() {
25+
@NotNull
26+
@Override
27+
public CoroutineContext getContext() {
28+
return EmptyCoroutineContext.INSTANCE;
29+
}
30+
31+
@Override
32+
public void resumeWith(@NotNull Object o) {
33+
String json = "";
34+
try {
35+
if (o instanceof Result.Failure) {
36+
Result.Failure failure = (Result.Failure) o;
37+
throw failure.exception;
38+
}
39+
} catch (Throwable th) {
40+
Log.e("ERROR", th.toString());
41+
}
42+
}
43+
}
44+
);
45+
}
46+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.createRecovery(
22+
23+
"https://example.com"
24+
new Continuation<Object>() {
25+
@NotNull
26+
@Override
27+
public CoroutineContext getContext() {
28+
return EmptyCoroutineContext.INSTANCE;
29+
}
30+
31+
@Override
32+
public void resumeWith(@NotNull Object o) {
33+
String json = "";
34+
try {
35+
if (o instanceof Result.Failure) {
36+
Result.Failure failure = (Result.Failure) o;
37+
throw failure.exception;
38+
} else {
39+
Response response = (Response) o;
40+
json = response.body().string();
41+
}
42+
} catch (Throwable th) {
43+
Log.e("ERROR", th.toString());
44+
}
45+
}
46+
}
47+
);
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.createSession(
22+
23+
"password"
24+
new Continuation<Object>() {
25+
@NotNull
26+
@Override
27+
public CoroutineContext getContext() {
28+
return EmptyCoroutineContext.INSTANCE;
29+
}
30+
31+
@Override
32+
public void resumeWith(@NotNull Object o) {
33+
String json = "";
34+
try {
35+
if (o instanceof Result.Failure) {
36+
Result.Failure failure = (Result.Failure) o;
37+
throw failure.exception;
38+
} else {
39+
Response response = (Response) o;
40+
json = response.body().string();
41+
}
42+
} catch (Throwable th) {
43+
Log.e("ERROR", th.toString());
44+
}
45+
}
46+
}
47+
);
48+
}
49+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.createVerification(
22+
"https://example.com"
23+
new Continuation<Object>() {
24+
@NotNull
25+
@Override
26+
public CoroutineContext getContext() {
27+
return EmptyCoroutineContext.INSTANCE;
28+
}
29+
30+
@Override
31+
public void resumeWith(@NotNull Object o) {
32+
String json = "";
33+
try {
34+
if (o instanceof Result.Failure) {
35+
Result.Failure failure = (Result.Failure) o;
36+
throw failure.exception;
37+
} else {
38+
Response response = (Response) o;
39+
json = response.body().string();
40+
}
41+
} catch (Throwable th) {
42+
Log.e("ERROR", th.toString());
43+
}
44+
}
45+
}
46+
);
47+
}
48+
}

docs/examples/java/account/create.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.create(
22+
23+
"password",
24+
new Continuation<Object>() {
25+
@NotNull
26+
@Override
27+
public CoroutineContext getContext() {
28+
return EmptyCoroutineContext.INSTANCE;
29+
}
30+
31+
@Override
32+
public void resumeWith(@NotNull Object o) {
33+
String json = "";
34+
try {
35+
if (o instanceof Result.Failure) {
36+
Result.Failure failure = (Result.Failure) o;
37+
throw failure.exception;
38+
} else {
39+
Response response = (Response) o;
40+
json = response.body().string();
41+
}
42+
} catch (Throwable th) {
43+
Log.e("ERROR", th.toString());
44+
}
45+
}
46+
}
47+
);
48+
}
49+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import androidx.appcompat.app.AppCompatActivity
2+
import android.os.Bundle
3+
import kotlinx.coroutines.GlobalScope
4+
import kotlinx.coroutines.launch
5+
import io.appwrite.Client
6+
import io.appwrite.services.Account
7+
8+
public class MainActivity extends AppCompatActivity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
15+
Client client = new Client(getApplicationContext())
16+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
17+
.setProject("5df5acd0d48c2"); // Your project ID
18+
19+
Account account = new Account(client);
20+
21+
account.deleteSession(
22+
"[SESSION_ID]"
23+
new Continuation<Object>() {
24+
@NotNull
25+
@Override
26+
public CoroutineContext getContext() {
27+
return EmptyCoroutineContext.INSTANCE;
28+
}
29+
30+
@Override
31+
public void resumeWith(@NotNull Object o) {
32+
String json = "";
33+
try {
34+
if (o instanceof Result.Failure) {
35+
Result.Failure failure = (Result.Failure) o;
36+
throw failure.exception;
37+
} else {
38+
Response response = (Response) o;
39+
json = response.body().string();
40+
}
41+
} catch (Throwable th) {
42+
Log.e("ERROR", th.toString());
43+
}
44+
}
45+
}
46+
);
47+
}
48+
}

0 commit comments

Comments
 (0)