diff --git a/docs/examples/java/functions/list-templates.md b/docs/examples/java/functions/list-templates.md deleted file mode 100644 index 6c051f3..0000000 --- a/docs/examples/java/functions/list-templates.md +++ /dev/null @@ -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 - -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()); - }) -); - diff --git a/docs/examples/kotlin/functions/list-templates.md b/docs/examples/kotlin/functions/list-templates.md deleted file mode 100644 index a1a59d9..0000000 --- a/docs/examples/kotlin/functions/list-templates.md +++ /dev/null @@ -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 - -val functions = Functions(client) - -val result = functions.listTemplates( - runtimes = listOf(), // (optional) - useCases = listOf(), // (optional) - limit = 1, // (optional) - offset = 0, // (optional) -) \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/TemplateFunctionList.kt b/library/src/main/java/io/appwrite/models/TemplateFunctionList.kt deleted file mode 100644 index 4cfce5d..0000000 --- a/library/src/main/java/io/appwrite/models/TemplateFunctionList.kt +++ /dev/null @@ -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, - -) { - fun toMap(): Map = mapOf( - "total" to total as Any, - "templates" to templates.map { it.toMap() } as Any, - ) - - companion object { - - @Suppress("UNCHECKED_CAST") - fun from( - map: Map, - ) = TemplateFunctionList( - total = (map["total"] as Number).toLong(), - templates = (map["templates"] as List>).map { TemplateFunction.from(map = it) }, - ) - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Functions.kt b/library/src/main/java/io/appwrite/services/Functions.kt index c0c0bc0..c3c6120 100644 --- a/library/src/main/java/io/appwrite/services/Functions.kt +++ b/library/src/main/java/io/appwrite/services/Functions.kt @@ -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? = null, - useCases: List? = null, - limit: Long? = null, - offset: Long? = null, - ): io.appwrite.models.TemplateFunctionList { - val apiPath = "/functions/templates" - - val apiParams = mutableMapOf( - "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) - } - return client.call( - "GET", - apiPath, - apiHeaders, - apiParams, - responseType = io.appwrite.models.TemplateFunctionList::class.java, - converter, - ) - } - - /** * Get function template *