mirror of
https://github.com/appwrite/sdk-for-android.git
synced 2026-04-07 19:17:49 +00:00
update to appwrite 1.3.0
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
[](https://twitter.com/appwrite)
|
||||
[](https://appwrite.io/discord)
|
||||
|
||||
**This SDK is compatible with Appwrite server version 1.2.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
|
||||
**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
|
||||
|
||||
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 Android 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)
|
||||
|
||||
@@ -38,7 +38,7 @@ repositories {
|
||||
Next, add the dependency to your project's `build.gradle(.kts)` file:
|
||||
|
||||
```groovy
|
||||
implementation("io.appwrite:sdk-for-android:1.2.1")
|
||||
implementation("io.appwrite:sdk-for-android:1.3.0")
|
||||
```
|
||||
|
||||
### Maven
|
||||
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
|
||||
<dependency>
|
||||
<groupId>io.appwrite</groupId>
|
||||
<artifactId>sdk-for-android</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ apply plugin: 'io.github.gradle-nexus.publish-plugin'
|
||||
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.kotlin_version = "1.7.10"
|
||||
ext.kotlin_version = "1.8.0"
|
||||
version System.getenv("SDK_VERSION")
|
||||
repositories {
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
|
||||
@@ -11,7 +11,7 @@ Account account = new Account(client);
|
||||
account.create(
|
||||
"[USER_ID]",
|
||||
"email@example.com",
|
||||
"password",
|
||||
"",
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
|
||||
@@ -9,7 +9,7 @@ Client client = new Client(context)
|
||||
Account account = new Account(client);
|
||||
|
||||
account.updatePassword(
|
||||
"password",
|
||||
"",
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
|
||||
@@ -11,7 +11,7 @@ Databases databases = new Databases(client);
|
||||
databases.getDocument(
|
||||
"[DATABASE_ID]",
|
||||
"[COLLECTION_ID]",
|
||||
"[DOCUMENT_ID]"
|
||||
"[DOCUMENT_ID]",
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
|
||||
@@ -10,7 +10,6 @@ Teams teams = new Teams(client);
|
||||
|
||||
teams.createMembership(
|
||||
"[TEAM_ID]",
|
||||
"email@example.com",
|
||||
listOf(),
|
||||
"https://example.com",
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Teams;
|
||||
|
||||
Client client = new Client(context)
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2"); // Your project ID
|
||||
|
||||
Teams teams = new Teams(client);
|
||||
|
||||
teams.getPrefs(
|
||||
"[TEAM_ID]"
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Appwrite", result.toString());
|
||||
})
|
||||
);
|
||||
@@ -8,7 +8,7 @@ Client client = new Client(context)
|
||||
|
||||
Teams teams = new Teams(client);
|
||||
|
||||
teams.update(
|
||||
teams.updateName(
|
||||
"[TEAM_ID]",
|
||||
"[NAME]"
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
@@ -0,0 +1,22 @@
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Teams;
|
||||
|
||||
Client client = new Client(context)
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2"); // Your project ID
|
||||
|
||||
Teams teams = new Teams(client);
|
||||
|
||||
teams.updatePrefs(
|
||||
"[TEAM_ID]",
|
||||
mapOf( "a" to "b" )
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Appwrite", result.toString());
|
||||
})
|
||||
);
|
||||
@@ -10,5 +10,5 @@ val account = Account(client)
|
||||
val response = account.create(
|
||||
userId = "[USER_ID]",
|
||||
email = "email@example.com",
|
||||
password = "password",
|
||||
password = "",
|
||||
)
|
||||
|
||||
@@ -8,5 +8,5 @@ val client = Client(context)
|
||||
val account = Account(client)
|
||||
|
||||
val response = account.updatePassword(
|
||||
password = "password",
|
||||
password = "",
|
||||
)
|
||||
|
||||
@@ -10,5 +10,5 @@ val databases = Databases(client)
|
||||
val response = databases.getDocument(
|
||||
databaseId = "[DATABASE_ID]",
|
||||
collectionId = "[COLLECTION_ID]",
|
||||
documentId = "[DOCUMENT_ID]"
|
||||
documentId = "[DOCUMENT_ID]",
|
||||
)
|
||||
|
||||
@@ -9,7 +9,6 @@ val teams = Teams(client)
|
||||
|
||||
val response = teams.createMembership(
|
||||
teamId = "[TEAM_ID]",
|
||||
email = "email@example.com",
|
||||
roles = listOf(),
|
||||
url = "https://example.com",
|
||||
)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import io.appwrite.Client
|
||||
import io.appwrite.services.Teams
|
||||
|
||||
val client = Client(context)
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
val teams = Teams(client)
|
||||
|
||||
val response = teams.getPrefs(
|
||||
teamId = "[TEAM_ID]"
|
||||
)
|
||||
@@ -7,7 +7,7 @@ val client = Client(context)
|
||||
|
||||
val teams = Teams(client)
|
||||
|
||||
val response = teams.update(
|
||||
val response = teams.updateName(
|
||||
teamId = "[TEAM_ID]",
|
||||
name = "[NAME]"
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
import io.appwrite.Client
|
||||
import io.appwrite.services.Teams
|
||||
|
||||
val client = Client(context)
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
val teams = Teams(client)
|
||||
|
||||
val response = teams.updatePrefs(
|
||||
teamId = "[TEAM_ID]",
|
||||
prefs = mapOf( "a" to "b" )
|
||||
)
|
||||
@@ -3,12 +3,12 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.appwrite.example_java"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 31
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -30,10 +30,10 @@ android {
|
||||
dependencies {
|
||||
implementation project(path: ':library')
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.0'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
+17
-17
@@ -4,12 +4,12 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.appwrite.android"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -39,20 +39,20 @@ dependencies {
|
||||
implementation project(path: ':library')
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.6.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
|
||||
implementation "androidx.fragment:fragment-ktx:1.3.6"
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
||||
implementation 'androidx.core:core-ktx:1.9.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.0'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
|
||||
implementation "androidx.fragment:fragment-ktx:1.5.5"
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1"
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#Tue Jun 01 15:55:54 IST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -53,7 +53,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
|
||||
|
||||
@@ -65,14 +65,14 @@ dependencies {
|
||||
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
|
||||
implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1")
|
||||
implementation("androidx.appcompat:appcompat:1.5.1")
|
||||
implementation("androidx.fragment:fragment-ktx:1.5.3")
|
||||
implementation("androidx.activity:activity-ktx:1.6.0")
|
||||
implementation("androidx.appcompat:appcompat:1.6.0")
|
||||
implementation("androidx.fragment:fragment-ktx:1.5.5")
|
||||
implementation("androidx.activity:activity-ktx:1.6.1")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
|
||||
testImplementation 'junit:junit:4.+'
|
||||
testImplementation "androidx.test.ext:junit-ktx:1.1.3"
|
||||
testImplementation "androidx.test:core-ktx:1.4.0"
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation "androidx.test.ext:junit-ktx:1.1.5"
|
||||
testImplementation "androidx.test:core-ktx:1.5.0"
|
||||
testImplementation "org.robolectric:robolectric:4.5.1"
|
||||
testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class Client @JvmOverloads constructor(
|
||||
"x-sdk-name" to "Android",
|
||||
"x-sdk-platform" to "client",
|
||||
"x-sdk-language" to "android",
|
||||
"x-sdk-version" to "1.2.1",
|
||||
"x-sdk-version" to "1.3.0",
|
||||
"x-appwrite-response-format" to "1.0.0"
|
||||
)
|
||||
config = mutableMapOf()
|
||||
|
||||
@@ -16,6 +16,22 @@ class Query {
|
||||
|
||||
fun search(attribute: String, value: String) = Query.addQuery(attribute, "search", value)
|
||||
|
||||
fun isNull(attribute: String) = "isNull(\"${attribute}\")"
|
||||
|
||||
fun isNotNull(attribute: String) = "isNotNull(\"${attribute}\")"
|
||||
|
||||
fun between(attribute: String, start: Int, end: Int) = Query.addQuery(attribute, "between", listOf(start, end))
|
||||
|
||||
fun between(attribute: String, start: Double, end: Double) = Query.addQuery(attribute, "between", listOf(start, end))
|
||||
|
||||
fun between(attribute: String, start: String, end: String) = Query.addQuery(attribute, "between", listOf(start, end))
|
||||
|
||||
fun startsWith(attribute: String, value: String) = Query.addQuery(attribute, "startsWith", value)
|
||||
|
||||
fun endsWith(attribute: String, value: String) = Query.addQuery(attribute, "endsWith", value)
|
||||
|
||||
fun select(attributes: List<String>) = "select([${attributes.joinToString(",") { "\"$it\"" }}])"
|
||||
|
||||
fun orderAsc(attribute: String) = "orderAsc(\"${attribute}\")"
|
||||
|
||||
fun orderDesc(attribute: String) = "orderDesc(\"${attribute}\")"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoArgon2
|
||||
*/
|
||||
data class AlgoArgon2(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
/**
|
||||
* Memory used to compute hash.
|
||||
*/
|
||||
@SerializedName("memoryCost")
|
||||
val memoryCost: Long,
|
||||
|
||||
/**
|
||||
* Amount of time consumed to compute hash
|
||||
*/
|
||||
@SerializedName("timeCost")
|
||||
val timeCost: Long,
|
||||
|
||||
/**
|
||||
* Number of threads used to compute hash.
|
||||
*/
|
||||
@SerializedName("threads")
|
||||
val threads: Long,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
"memoryCost" to memoryCost as Any,
|
||||
"timeCost" to timeCost as Any,
|
||||
"threads" to threads as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoArgon2(
|
||||
type = map["type"] as String,
|
||||
memoryCost = (map["memoryCost"] as Number).toLong(),
|
||||
timeCost = (map["timeCost"] as Number).toLong(),
|
||||
threads = (map["threads"] as Number).toLong(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoBcrypt
|
||||
*/
|
||||
data class AlgoBcrypt(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoBcrypt(
|
||||
type = map["type"] as String,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoMD5
|
||||
*/
|
||||
data class AlgoMd5(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoMd5(
|
||||
type = map["type"] as String,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoPHPass
|
||||
*/
|
||||
data class AlgoPhpass(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoPhpass(
|
||||
type = map["type"] as String,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoScrypt
|
||||
*/
|
||||
data class AlgoScrypt(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
/**
|
||||
* CPU complexity of computed hash.
|
||||
*/
|
||||
@SerializedName("costCpu")
|
||||
val costCpu: Long,
|
||||
|
||||
/**
|
||||
* Memory complexity of computed hash.
|
||||
*/
|
||||
@SerializedName("costMemory")
|
||||
val costMemory: Long,
|
||||
|
||||
/**
|
||||
* Parallelization of computed hash.
|
||||
*/
|
||||
@SerializedName("costParallel")
|
||||
val costParallel: Long,
|
||||
|
||||
/**
|
||||
* Length used to compute hash.
|
||||
*/
|
||||
@SerializedName("length")
|
||||
val length: Long,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
"costCpu" to costCpu as Any,
|
||||
"costMemory" to costMemory as Any,
|
||||
"costParallel" to costParallel as Any,
|
||||
"length" to length as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoScrypt(
|
||||
type = map["type"] as String,
|
||||
costCpu = (map["costCpu"] as Number).toLong(),
|
||||
costMemory = (map["costMemory"] as Number).toLong(),
|
||||
costParallel = (map["costParallel"] as Number).toLong(),
|
||||
length = (map["length"] as Number).toLong(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoScryptModified
|
||||
*/
|
||||
data class AlgoScryptModified(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
/**
|
||||
* Salt used to compute hash.
|
||||
*/
|
||||
@SerializedName("salt")
|
||||
val salt: String,
|
||||
|
||||
/**
|
||||
* Separator used to compute hash.
|
||||
*/
|
||||
@SerializedName("saltSeparator")
|
||||
val saltSeparator: String,
|
||||
|
||||
/**
|
||||
* Key used to compute hash.
|
||||
*/
|
||||
@SerializedName("signerKey")
|
||||
val signerKey: String,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
"salt" to salt as Any,
|
||||
"saltSeparator" to saltSeparator as Any,
|
||||
"signerKey" to signerKey as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoScryptModified(
|
||||
type = map["type"] as String,
|
||||
salt = map["salt"] as String,
|
||||
saltSeparator = map["saltSeparator"] as String,
|
||||
signerKey = map["signerKey"] as String,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.appwrite.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* AlgoSHA
|
||||
*/
|
||||
data class AlgoSha(
|
||||
/**
|
||||
* Algo type.
|
||||
*/
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"type" to type as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
map: Map<String, Any>,
|
||||
) = AlgoSha(
|
||||
type = map["type"] as String,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import io.appwrite.extensions.jsonCast
|
||||
/**
|
||||
* Team
|
||||
*/
|
||||
data class Team(
|
||||
data class Team<T>(
|
||||
/**
|
||||
* Team ID.
|
||||
*/
|
||||
@@ -37,6 +37,12 @@ data class Team(
|
||||
@SerializedName("total")
|
||||
val total: Long,
|
||||
|
||||
/**
|
||||
* Team preferences as a key-value object
|
||||
*/
|
||||
@SerializedName("prefs")
|
||||
val prefs: Preferences<T>,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"\$id" to id as Any,
|
||||
@@ -44,19 +50,37 @@ data class Team(
|
||||
"\$updatedAt" to updatedAt as Any,
|
||||
"name" to name as Any,
|
||||
"total" to total as Any,
|
||||
"prefs" to prefs.toMap() as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
operator fun invoke(
|
||||
id: String,
|
||||
createdAt: String,
|
||||
updatedAt: String,
|
||||
name: String,
|
||||
total: Long,
|
||||
prefs: Preferences<Map<String, Any>>,
|
||||
) = Team<Map<String, Any>>(
|
||||
id,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
name,
|
||||
total,
|
||||
prefs,
|
||||
)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
fun <T> from(
|
||||
map: Map<String, Any>,
|
||||
) = Team(
|
||||
nestedType: Class<T>
|
||||
) = Team<T>(
|
||||
id = map["\$id"] as String,
|
||||
createdAt = map["\$createdAt"] as String,
|
||||
updatedAt = map["\$updatedAt"] as String,
|
||||
name = map["name"] as String,
|
||||
total = (map["total"] as Number).toLong(),
|
||||
prefs = Preferences.from(map = map["prefs"] as Map<String, Any>, nestedType),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import io.appwrite.extensions.jsonCast
|
||||
/**
|
||||
* Teams List
|
||||
*/
|
||||
data class TeamList(
|
||||
data class TeamList<T>(
|
||||
/**
|
||||
* Total number of teams documents that matched your query.
|
||||
*/
|
||||
@@ -17,7 +17,7 @@ data class TeamList(
|
||||
* List of teams.
|
||||
*/
|
||||
@SerializedName("teams")
|
||||
val teams: List<Team>,
|
||||
val teams: List<Team<T>>,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
@@ -26,13 +26,21 @@ data class TeamList(
|
||||
)
|
||||
|
||||
companion object {
|
||||
operator fun invoke(
|
||||
total: Long,
|
||||
teams: List<Team<Map<String, Any>>>,
|
||||
) = TeamList<Map<String, Any>>(
|
||||
total,
|
||||
teams,
|
||||
)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun from(
|
||||
fun <T> from(
|
||||
map: Map<String, Any>,
|
||||
) = TeamList(
|
||||
nestedType: Class<T>
|
||||
) = TeamList<T>(
|
||||
total = (map["total"] as Number).toLong(),
|
||||
teams = (map["teams"] as List<Map<String, Any>>).map { Team.from(map = it) },
|
||||
teams = (map["teams"] as List<Map<String, Any>>).map { Team.from(map = it, nestedType) },
|
||||
)
|
||||
}
|
||||
}
|
||||
+34
-4
@@ -4,9 +4,9 @@ import com.google.gson.annotations.SerializedName
|
||||
import io.appwrite.extensions.jsonCast
|
||||
|
||||
/**
|
||||
* Account
|
||||
* User
|
||||
*/
|
||||
data class Account<T>(
|
||||
data class User<T>(
|
||||
/**
|
||||
* User ID.
|
||||
*/
|
||||
@@ -31,6 +31,24 @@ data class Account<T>(
|
||||
@SerializedName("name")
|
||||
val name: String,
|
||||
|
||||
/**
|
||||
* Hashed user password.
|
||||
*/
|
||||
@SerializedName("password")
|
||||
var password: String?,
|
||||
|
||||
/**
|
||||
* Password hashing algorithm.
|
||||
*/
|
||||
@SerializedName("hash")
|
||||
var hash: String?,
|
||||
|
||||
/**
|
||||
* Password hashing algorithm configuration.
|
||||
*/
|
||||
@SerializedName("hashOptions")
|
||||
var hashOptions: Any?,
|
||||
|
||||
/**
|
||||
* User registration date in ISO 8601 format.
|
||||
*/
|
||||
@@ -85,6 +103,9 @@ data class Account<T>(
|
||||
"\$createdAt" to createdAt as Any,
|
||||
"\$updatedAt" to updatedAt as Any,
|
||||
"name" to name as Any,
|
||||
"password" to password as Any,
|
||||
"hash" to hash as Any,
|
||||
"hashOptions" to hashOptions as Any,
|
||||
"registration" to registration as Any,
|
||||
"status" to status as Any,
|
||||
"passwordUpdate" to passwordUpdate as Any,
|
||||
@@ -101,6 +122,9 @@ data class Account<T>(
|
||||
createdAt: String,
|
||||
updatedAt: String,
|
||||
name: String,
|
||||
password: String?,
|
||||
hash: String?,
|
||||
hashOptions: Any?,
|
||||
registration: String,
|
||||
status: Boolean,
|
||||
passwordUpdate: String,
|
||||
@@ -109,11 +133,14 @@ data class Account<T>(
|
||||
emailVerification: Boolean,
|
||||
phoneVerification: Boolean,
|
||||
prefs: Preferences<Map<String, Any>>,
|
||||
) = Account<Map<String, Any>>(
|
||||
) = User<Map<String, Any>>(
|
||||
id,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
name,
|
||||
password,
|
||||
hash,
|
||||
hashOptions,
|
||||
registration,
|
||||
status,
|
||||
passwordUpdate,
|
||||
@@ -128,11 +155,14 @@ data class Account<T>(
|
||||
fun <T> from(
|
||||
map: Map<String, Any>,
|
||||
nestedType: Class<T>
|
||||
) = Account<T>(
|
||||
) = User<T>(
|
||||
id = map["\$id"] as String,
|
||||
createdAt = map["\$createdAt"] as String,
|
||||
updatedAt = map["\$updatedAt"] as String,
|
||||
name = map["name"] as String,
|
||||
password = map["password"] as? String?,
|
||||
hash = map["hash"] as? String?,
|
||||
hashOptions = map["hashOptions"] as? Any?,
|
||||
registration = map["registration"] as String,
|
||||
status = map["status"] as Boolean,
|
||||
passwordUpdate = map["passwordUpdate"] as String,
|
||||
@@ -24,11 +24,11 @@ class Account : Service {
|
||||
*
|
||||
* Get currently logged in user data as JSON object.
|
||||
*
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
suspend fun <T> get(
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -36,8 +36,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
@@ -54,11 +54,11 @@ class Account : Service {
|
||||
*
|
||||
* Get currently logged in user data as JSON object.
|
||||
*
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun get(
|
||||
) = get(
|
||||
): io.appwrite.models.User<Map<String, Any>> = get(
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
@@ -69,9 +69,9 @@ class Account : Service {
|
||||
*
|
||||
* @param userId Unique 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.
|
||||
* @param email User email.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
* @param password New user password. Must be at least 8 chars.
|
||||
* @param name User name. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
suspend fun <T> create(
|
||||
@@ -80,7 +80,7 @@ class Account : Service {
|
||||
password: String,
|
||||
name: String? = null,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -92,8 +92,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"POST",
|
||||
@@ -112,9 +112,9 @@ class Account : Service {
|
||||
*
|
||||
* @param userId Unique 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.
|
||||
* @param email User email.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
* @param password New user password. Must be at least 8 chars.
|
||||
* @param name User name. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@Throws(AppwriteException::class)
|
||||
@@ -123,7 +123,7 @@ class Account : Service {
|
||||
email: String,
|
||||
password: String,
|
||||
name: String? = null,
|
||||
) = create(
|
||||
): io.appwrite.models.User<Map<String, Any>> = create(
|
||||
userId,
|
||||
email,
|
||||
password,
|
||||
@@ -138,13 +138,13 @@ class Account : Service {
|
||||
*
|
||||
* @param email User email.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
suspend fun <T> updateEmail(
|
||||
email: String,
|
||||
password: String,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account/email"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -154,8 +154,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PATCH",
|
||||
@@ -174,13 +174,13 @@ class Account : Service {
|
||||
*
|
||||
* @param email User email.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updateEmail(
|
||||
email: String,
|
||||
password: String,
|
||||
) = updateEmail(
|
||||
): io.appwrite.models.User<Map<String, Any>> = updateEmail(
|
||||
email,
|
||||
password,
|
||||
nestedType = classOf(),
|
||||
@@ -221,7 +221,7 @@ class Account : Service {
|
||||
*
|
||||
* Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.
|
||||
*
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
||||
* @return [io.appwrite.models.LogList]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@@ -256,12 +256,12 @@ class Account : Service {
|
||||
* Update currently logged in user account name.
|
||||
*
|
||||
* @param name User name. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
suspend fun <T> updateName(
|
||||
name: String,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account/name"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -270,8 +270,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PATCH",
|
||||
@@ -289,12 +289,12 @@ class Account : Service {
|
||||
* Update currently logged in user account name.
|
||||
*
|
||||
* @param name User name. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updateName(
|
||||
name: String,
|
||||
) = updateName(
|
||||
): io.appwrite.models.User<Map<String, Any>> = updateName(
|
||||
name,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
@@ -306,14 +306,14 @@ class Account : Service {
|
||||
*
|
||||
* @param password New user password. Must be at least 8 chars.
|
||||
* @param oldPassword Current user password. Must be at least 8 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
suspend fun <T> updatePassword(
|
||||
password: String,
|
||||
oldPassword: String? = null,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account/password"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -323,8 +323,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PATCH",
|
||||
@@ -343,14 +343,14 @@ class Account : Service {
|
||||
*
|
||||
* @param password New user password. Must be at least 8 chars.
|
||||
* @param oldPassword Current user password. Must be at least 8 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updatePassword(
|
||||
password: String,
|
||||
oldPassword: String? = null,
|
||||
) = updatePassword(
|
||||
): io.appwrite.models.User<Map<String, Any>> = updatePassword(
|
||||
password,
|
||||
oldPassword,
|
||||
nestedType = classOf(),
|
||||
@@ -363,13 +363,13 @@ class Account : Service {
|
||||
*
|
||||
* @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
suspend fun <T> updatePhone(
|
||||
phone: String,
|
||||
password: String,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account/phone"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -379,8 +379,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PATCH",
|
||||
@@ -399,13 +399,13 @@ class Account : Service {
|
||||
*
|
||||
* @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updatePhone(
|
||||
phone: String,
|
||||
password: String,
|
||||
) = updatePhone(
|
||||
): io.appwrite.models.User<Map<String, Any>> = updatePhone(
|
||||
phone,
|
||||
password,
|
||||
nestedType = classOf(),
|
||||
@@ -450,7 +450,7 @@ class Account : Service {
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun getPrefs(
|
||||
) = getPrefs(
|
||||
): io.appwrite.models.Preferences<Map<String, Any>> = getPrefs(
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
@@ -460,12 +460,12 @@ class Account : Service {
|
||||
* Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
||||
*
|
||||
* @param prefs Prefs key-value JSON object.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
suspend fun <T> updatePrefs(
|
||||
prefs: Any,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account/prefs"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -474,8 +474,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PATCH",
|
||||
@@ -493,12 +493,12 @@ class Account : Service {
|
||||
* Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
||||
*
|
||||
* @param prefs Prefs key-value JSON object.
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updatePrefs(
|
||||
prefs: Any,
|
||||
) = updatePrefs(
|
||||
): io.appwrite.models.User<Map<String, Any>> = updatePrefs(
|
||||
prefs,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
@@ -670,7 +670,7 @@ class Account : Service {
|
||||
/**
|
||||
* Create Email Session
|
||||
*
|
||||
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication#limits).
|
||||
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits).
|
||||
*
|
||||
* @param email User email.
|
||||
* @param password User password. Must be at least 8 chars.
|
||||
@@ -706,7 +706,7 @@ class Account : Service {
|
||||
/**
|
||||
* Create Magic URL session
|
||||
*
|
||||
* Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication#limits).
|
||||
* Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits).
|
||||
*
|
||||
* @param userId Unique 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.
|
||||
* @param email User email.
|
||||
@@ -782,7 +782,7 @@ class Account : Service {
|
||||
/**
|
||||
* Create OAuth2 Session
|
||||
*
|
||||
* 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'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](/docs/authentication#limits).
|
||||
* 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'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](/docs/authentication-security#limits).
|
||||
*
|
||||
* @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, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.
|
||||
* @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project 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.
|
||||
@@ -854,7 +854,7 @@ class Account : Service {
|
||||
/**
|
||||
* Create Phone session
|
||||
*
|
||||
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication#limits).
|
||||
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits).
|
||||
*
|
||||
* @param userId Unique 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.
|
||||
* @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
||||
@@ -1023,11 +1023,11 @@ class Account : Service {
|
||||
*
|
||||
* Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
|
||||
*
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
suspend fun <T> updateStatus(
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Account<T> {
|
||||
): io.appwrite.models.User<T> {
|
||||
val path = "/account/status"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -1035,8 +1035,8 @@ class Account : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Account<T> = {
|
||||
io.appwrite.models.Account.from(map = it as Map<String, Any>, nestedType)
|
||||
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PATCH",
|
||||
@@ -1053,11 +1053,11 @@ class Account : Service {
|
||||
*
|
||||
* Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
|
||||
*
|
||||
* @return [io.appwrite.models.Account<T>]
|
||||
* @return [io.appwrite.models.User<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updateStatus(
|
||||
) = updateStatus(
|
||||
): io.appwrite.models.User<Map<String, Any>> = updateStatus(
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class Databases : Service {
|
||||
*
|
||||
* @param databaseId Database ID.
|
||||
* @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
||||
* @return [io.appwrite.models.DocumentList<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@@ -62,7 +62,7 @@ class Databases : Service {
|
||||
*
|
||||
* @param databaseId Database ID.
|
||||
* @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
||||
* @return [io.appwrite.models.DocumentList<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@@ -71,7 +71,7 @@ class Databases : Service {
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
queries: List<String>? = null,
|
||||
) = listDocuments(
|
||||
): io.appwrite.models.DocumentList<Map<String, Any>> = listDocuments(
|
||||
databaseId,
|
||||
collectionId,
|
||||
queries,
|
||||
@@ -144,7 +144,7 @@ class Databases : Service {
|
||||
documentId: String,
|
||||
data: Any,
|
||||
permissions: List<String>? = null,
|
||||
) = createDocument(
|
||||
): io.appwrite.models.Document<Map<String, Any>> = createDocument(
|
||||
databaseId,
|
||||
collectionId,
|
||||
documentId,
|
||||
@@ -161,12 +161,15 @@ class Databases : Service {
|
||||
* @param databaseId Database ID.
|
||||
* @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
||||
* @param documentId Document ID.
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select.
|
||||
* @return [io.appwrite.models.Document<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
suspend fun <T> getDocument(
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
documentId: String,
|
||||
queries: List<String>? = null,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Document<T> {
|
||||
val path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}"
|
||||
@@ -175,6 +178,7 @@ class Databases : Service {
|
||||
.replace("{documentId}", documentId)
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
"queries" to queries,
|
||||
)
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
@@ -200,17 +204,21 @@ class Databases : Service {
|
||||
* @param databaseId Database ID.
|
||||
* @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
||||
* @param documentId Document ID.
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select.
|
||||
* @return [io.appwrite.models.Document<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun getDocument(
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
documentId: String,
|
||||
) = getDocument(
|
||||
queries: List<String>? = null,
|
||||
): io.appwrite.models.Document<Map<String, Any>> = getDocument(
|
||||
databaseId,
|
||||
collectionId,
|
||||
documentId,
|
||||
queries,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
@@ -280,7 +288,7 @@ class Databases : Service {
|
||||
documentId: String,
|
||||
data: Any? = null,
|
||||
permissions: List<String>? = null,
|
||||
) = updateDocument(
|
||||
): io.appwrite.models.Document<Map<String, Any>> = updateDocument(
|
||||
databaseId,
|
||||
collectionId,
|
||||
documentId,
|
||||
|
||||
@@ -21,7 +21,7 @@ class Functions : Service {
|
||||
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
|
||||
*
|
||||
* @param functionId Function ID.
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, statusCode, duration
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, statusCode, duration
|
||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||
* @return [io.appwrite.models.ExecutionList]
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ class Storage : Service {
|
||||
* Get a list of all the user files. You can use the query params to filter your results.
|
||||
*
|
||||
* @param bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
|
||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||
* @return [io.appwrite.models.FileList]
|
||||
*/
|
||||
|
||||
@@ -20,15 +20,16 @@ class Teams : Service {
|
||||
*
|
||||
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
|
||||
*
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total
|
||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||
* @return [io.appwrite.models.TeamList]
|
||||
* @return [io.appwrite.models.TeamList<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
suspend fun list(
|
||||
suspend fun <T> list(
|
||||
queries: List<String>? = null,
|
||||
search: String? = null,
|
||||
): io.appwrite.models.TeamList {
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.TeamList<T> {
|
||||
val path = "/teams"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -38,19 +39,38 @@ class Teams : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.TeamList = {
|
||||
io.appwrite.models.TeamList.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.TeamList<T> = {
|
||||
io.appwrite.models.TeamList.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
path,
|
||||
headers,
|
||||
params,
|
||||
responseType = io.appwrite.models.TeamList::class.java,
|
||||
responseType = classOf(),
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* List Teams
|
||||
*
|
||||
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
|
||||
*
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total
|
||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||
* @return [io.appwrite.models.TeamList<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun list(
|
||||
queries: List<String>? = null,
|
||||
search: String? = null,
|
||||
): io.appwrite.models.TeamList<Map<String, Any>> = list(
|
||||
queries,
|
||||
search,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* Create Team
|
||||
@@ -60,14 +80,15 @@ class Teams : Service {
|
||||
* @param teamId Team 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.
|
||||
* @param name Team name. Max length: 128 chars.
|
||||
* @param roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
|
||||
* @return [io.appwrite.models.Team]
|
||||
* @return [io.appwrite.models.Team<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
suspend fun create(
|
||||
suspend fun <T> create(
|
||||
teamId: String,
|
||||
name: String,
|
||||
roles: List<String>? = null,
|
||||
): io.appwrite.models.Team {
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Team<T> {
|
||||
val path = "/teams"
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
@@ -78,19 +99,41 @@ class Teams : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Team = {
|
||||
io.appwrite.models.Team.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.Team<T> = {
|
||||
io.appwrite.models.Team.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"POST",
|
||||
path,
|
||||
headers,
|
||||
params,
|
||||
responseType = io.appwrite.models.Team::class.java,
|
||||
responseType = classOf(),
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Team
|
||||
*
|
||||
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
|
||||
*
|
||||
* @param teamId Team 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.
|
||||
* @param name Team name. Max length: 128 chars.
|
||||
* @param roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
|
||||
* @return [io.appwrite.models.Team<T>]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun create(
|
||||
teamId: String,
|
||||
name: String,
|
||||
roles: List<String>? = null,
|
||||
): io.appwrite.models.Team<Map<String, Any>> = create(
|
||||
teamId,
|
||||
name,
|
||||
roles,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* Get Team
|
||||
@@ -98,11 +141,12 @@ class Teams : Service {
|
||||
* Get a team by its ID. All team members have read access for this resource.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @return [io.appwrite.models.Team]
|
||||
* @return [io.appwrite.models.Team<T>]
|
||||
*/
|
||||
suspend fun get(
|
||||
suspend fun <T> get(
|
||||
teamId: String,
|
||||
): io.appwrite.models.Team {
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Team<T> {
|
||||
val path = "/teams/{teamId}"
|
||||
.replace("{teamId}", teamId)
|
||||
|
||||
@@ -111,33 +155,49 @@ class Teams : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Team = {
|
||||
io.appwrite.models.Team.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.Team<T> = {
|
||||
io.appwrite.models.Team.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
path,
|
||||
headers,
|
||||
params,
|
||||
responseType = io.appwrite.models.Team::class.java,
|
||||
responseType = classOf(),
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Team
|
||||
*
|
||||
* Get a team by its ID. All team members have read access for this resource.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @return [io.appwrite.models.Team<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun get(
|
||||
teamId: String,
|
||||
): io.appwrite.models.Team<Map<String, Any>> = get(
|
||||
teamId,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* Update Team
|
||||
* Update Name
|
||||
*
|
||||
* Update a team using its ID. Only members with the owner role can update the team.
|
||||
* Update the team's name by its unique ID.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @param name New team name. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Team]
|
||||
* @return [io.appwrite.models.Team<T>]
|
||||
*/
|
||||
suspend fun update(
|
||||
suspend fun <T> updateName(
|
||||
teamId: String,
|
||||
name: String,
|
||||
): io.appwrite.models.Team {
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Team<T> {
|
||||
val path = "/teams/{teamId}"
|
||||
.replace("{teamId}", teamId)
|
||||
|
||||
@@ -147,19 +207,37 @@ class Teams : Service {
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Team = {
|
||||
io.appwrite.models.Team.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.Team<T> = {
|
||||
io.appwrite.models.Team.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PUT",
|
||||
path,
|
||||
headers,
|
||||
params,
|
||||
responseType = io.appwrite.models.Team::class.java,
|
||||
responseType = classOf(),
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Name
|
||||
*
|
||||
* Update the team's name by its unique ID.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @param name New team name. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Team<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updateName(
|
||||
teamId: String,
|
||||
name: String,
|
||||
): io.appwrite.models.Team<Map<String, Any>> = updateName(
|
||||
teamId,
|
||||
name,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* Delete Team
|
||||
@@ -196,7 +274,7 @@ class Teams : Service {
|
||||
* Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm
|
||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm
|
||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||
* @return [io.appwrite.models.MembershipList]
|
||||
*/
|
||||
@@ -233,21 +311,25 @@ class Teams : Service {
|
||||
/**
|
||||
* Create Team Membership
|
||||
*
|
||||
* Invite a new member to join your team. If initiated from the client SDK, an email with a link to join the team will be sent to the member's email address and an account will be created for them should they not be signed up already. If initiated from server-side SDKs, the new member will automatically be added to the team.Use the 'url' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when adding your platforms in the console interface.
|
||||
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @param email Email of the new team member.
|
||||
* @param roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
|
||||
* @param url URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project 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.
|
||||
* @param email Email of the new team member.
|
||||
* @param userId ID of the user to be added to a team.
|
||||
* @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
||||
* @param name Name of the new team member. Max length: 128 chars.
|
||||
* @return [io.appwrite.models.Membership]
|
||||
*/
|
||||
@JvmOverloads
|
||||
suspend fun createMembership(
|
||||
teamId: String,
|
||||
email: String,
|
||||
roles: List<String>,
|
||||
url: String,
|
||||
email: String? = null,
|
||||
userId: String? = null,
|
||||
phone: String? = null,
|
||||
name: String? = null,
|
||||
): io.appwrite.models.Membership {
|
||||
val path = "/teams/{teamId}/memberships"
|
||||
@@ -255,6 +337,8 @@ class Teams : Service {
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
"email" to email,
|
||||
"userId" to userId,
|
||||
"phone" to phone,
|
||||
"roles" to roles,
|
||||
"url" to url,
|
||||
"name" to name,
|
||||
@@ -425,4 +509,108 @@ class Teams : Service {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Team Preferences
|
||||
*
|
||||
* Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](/docs/client/account#accountGetPrefs).
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @return [io.appwrite.models.Preferences<T>]
|
||||
*/
|
||||
suspend fun <T> getPrefs(
|
||||
teamId: String,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Preferences<T> {
|
||||
val path = "/teams/{teamId}/prefs"
|
||||
.replace("{teamId}", teamId)
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
)
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Preferences<T> = {
|
||||
io.appwrite.models.Preferences.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
path,
|
||||
headers,
|
||||
params,
|
||||
responseType = classOf(),
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Team Preferences
|
||||
*
|
||||
* Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](/docs/client/account#accountGetPrefs).
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @return [io.appwrite.models.Preferences<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun getPrefs(
|
||||
teamId: String,
|
||||
): io.appwrite.models.Preferences<Map<String, Any>> = getPrefs(
|
||||
teamId,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* Update Preferences
|
||||
*
|
||||
* Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @param prefs Prefs key-value JSON object.
|
||||
* @return [io.appwrite.models.Preferences<T>]
|
||||
*/
|
||||
suspend fun <T> updatePrefs(
|
||||
teamId: String,
|
||||
prefs: Any,
|
||||
nestedType: Class<T>,
|
||||
): io.appwrite.models.Preferences<T> {
|
||||
val path = "/teams/{teamId}/prefs"
|
||||
.replace("{teamId}", teamId)
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
"prefs" to prefs,
|
||||
)
|
||||
val headers = mutableMapOf(
|
||||
"content-type" to "application/json",
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.Preferences<T> = {
|
||||
io.appwrite.models.Preferences.from(map = it as Map<String, Any>, nestedType)
|
||||
}
|
||||
return client.call(
|
||||
"PUT",
|
||||
path,
|
||||
headers,
|
||||
params,
|
||||
responseType = classOf(),
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Preferences
|
||||
*
|
||||
* Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
|
||||
*
|
||||
* @param teamId Team ID.
|
||||
* @param prefs Prefs key-value JSON object.
|
||||
* @return [io.appwrite.models.Preferences<T>]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun updatePrefs(
|
||||
teamId: String,
|
||||
prefs: Any,
|
||||
): io.appwrite.models.Preferences<Map<String, Any>> = updatePrefs(
|
||||
teamId,
|
||||
prefs,
|
||||
nestedType = classOf(),
|
||||
)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user