chore: update Appwrite version

This commit is contained in:
root
2024-08-27 10:53:56 +00:00
parent a3606b7514
commit 5aefbda6b6
4 changed files with 0 additions and 123 deletions
@@ -1,25 +0,0 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID
Functions functions = new Functions(client);
functions.listTemplates(
listOf(), // runtimes (optional)
listOf(), // useCases (optional)
1, // limit (optional)
0, // offset (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
Log.d("Appwrite", result.toString());
})
);
@@ -1,16 +0,0 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions
val client = Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
val functions = Functions(client)
val result = functions.listTemplates(
runtimes = listOf(), // (optional)
useCases = listOf(), // (optional)
limit = 1, // (optional)
offset = 0, // (optional)
)
@@ -1,38 +0,0 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
import io.appwrite.extensions.jsonCast
/**
* Function Templates List
*/
data class TemplateFunctionList(
/**
* Total number of templates documents that matched your query.
*/
@SerializedName("total")
val total: Long,
/**
* List of templates.
*/
@SerializedName("templates")
val templates: List<TemplateFunction>,
) {
fun toMap(): Map<String, Any> = mapOf(
"total" to total as Any,
"templates" to templates.map { it.toMap() } as Any,
)
companion object {
@Suppress("UNCHECKED_CAST")
fun from(
map: Map<String, Any>,
) = TemplateFunctionList(
total = (map["total"] as Number).toLong(),
templates = (map["templates"] as List<Map<String, Any>>).map { TemplateFunction.from(map = it) },
)
}
}
@@ -17,50 +17,6 @@ import java.io.File
**/
class Functions(client: Client) : Service(client) {
/**
* List function templates
*
* List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.
*
* @param runtimes List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.
* @param useCases List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.
* @param limit Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.
* @param offset Offset the list of returned templates. Maximum offset is 5000.
* @return [io.appwrite.models.TemplateFunctionList]
*/
@JvmOverloads
suspend fun listTemplates(
runtimes: List<String>? = null,
useCases: List<String>? = null,
limit: Long? = null,
offset: Long? = null,
): io.appwrite.models.TemplateFunctionList {
val apiPath = "/functions/templates"
val apiParams = mutableMapOf<String, Any?>(
"runtimes" to runtimes,
"useCases" to useCases,
"limit" to limit,
"offset" to offset,
)
val apiHeaders = mutableMapOf(
"content-type" to "application/json",
)
val converter: (Any) -> io.appwrite.models.TemplateFunctionList = {
@Suppress("UNCHECKED_CAST")
io.appwrite.models.TemplateFunctionList.from(map = it as Map<String, Any>)
}
return client.call(
"GET",
apiPath,
apiHeaders,
apiParams,
responseType = io.appwrite.models.TemplateFunctionList::class.java,
converter,
)
}
/**
* Get function template
*