2026-02-03 10:18:48 +00:00
|
|
|
```kotlin
|
2025-06-19 12:43:27 +00:00
|
|
|
import io.appwrite.Client
|
|
|
|
|
import io.appwrite.coroutines.CoroutineCallback
|
|
|
|
|
import io.appwrite.services.Functions
|
2025-11-23 06:39:28 +00:00
|
|
|
import io.appwrite.enums.TemplateReferenceType
|
2025-06-19 12:43:27 +00:00
|
|
|
|
|
|
|
|
val client = Client()
|
|
|
|
|
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
|
|
|
|
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
|
|
|
|
.setKey("<YOUR_API_KEY>") // Your secret API key
|
|
|
|
|
|
|
|
|
|
val functions = Functions(client)
|
|
|
|
|
|
|
|
|
|
val response = functions.createTemplateDeployment(
|
|
|
|
|
functionId = "<FUNCTION_ID>",
|
|
|
|
|
repository = "<REPOSITORY>",
|
|
|
|
|
owner = "<OWNER>",
|
|
|
|
|
rootDirectory = "<ROOT_DIRECTORY>",
|
2026-02-02 11:56:20 +00:00
|
|
|
type = TemplateReferenceType.COMMIT,
|
2025-11-18 04:23:55 +00:00
|
|
|
reference = "<REFERENCE>",
|
2025-06-19 12:43:27 +00:00
|
|
|
activate = false // optional
|
|
|
|
|
)
|
2026-02-03 10:18:48 +00:00
|
|
|
```
|