appwrite/docs/examples/1.5.x/server-kotlin/java/functions/create.md

46 lines
1.5 KiB
Markdown
Raw Normal View History

2024-02-05 12:40:51 +00:00
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions;
import io.appwrite.enums.Runtime;
Client client = new Client()
2025-04-22 13:02:33 +00:00
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your secret API key
2024-02-05 12:40:51 +00:00
Functions functions = new Functions(client);
functions.create(
2024-02-24 11:34:42 +00:00
"<FUNCTION_ID>", // functionId
"<NAME>", // name
2024-03-08 09:58:46 +00:00
.NODE_14_5, // runtime
2024-02-21 11:31:50 +00:00
listOf("any"), // execute (optional)
listOf(), // events (optional)
"", // schedule (optional)
1, // timeout (optional)
false, // enabled (optional)
false, // logging (optional)
2024-02-24 11:34:42 +00:00
"<ENTRYPOINT>", // entrypoint (optional)
"<COMMANDS>", // commands (optional)
2025-04-22 13:02:33 +00:00
listOf(), // scopes (optional)
2024-02-24 11:34:42 +00:00
"<INSTALLATION_ID>", // installationId (optional)
"<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional)
"<PROVIDER_BRANCH>", // providerBranch (optional)
2024-02-21 11:31:50 +00:00
false, // providerSilentMode (optional)
2024-02-24 11:34:42 +00:00
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
"<TEMPLATE_REPOSITORY>", // templateRepository (optional)
"<TEMPLATE_OWNER>", // templateOwner (optional)
"<TEMPLATE_ROOT_DIRECTORY>", // templateRootDirectory (optional)
2025-04-22 13:02:33 +00:00
"<TEMPLATE_VERSION>", // templateVersion (optional)
"", // specification (optional)
2024-02-05 12:40:51 +00:00
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
2024-02-21 11:31:50 +00:00