You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 17, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+48-2Lines changed: 48 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,63 @@ WARNING: Work in Progress (WIP) not ready for production
5
5
6
6
The runtime provides Kotlin running on Java 8u131 b11.
7
7
8
+
## Hello World Kotlin Action
9
+
10
+
The runtime for Kotlin supports two types of API for creating actions:
11
+
1. JSON parameter and return type, using the GSON Library.
12
+
2. Data Class parameter and return type.
13
+
14
+
### JSON parameter based main.kt
15
+
The following shows how to build a "HelloWorld" action using JSON parameters:
16
+
17
+
```kotlin
18
+
importcom.google.gson.JsonObject
19
+
20
+
funmain(args:JsonObject) : JsonObject {
21
+
val name = args.getAsJsonPrimitive("name").getAsString();
22
+
val hello =JsonObject();
23
+
hello.addProperty("greeting", "Hello "+ name +"!");
24
+
return hello
25
+
}
26
+
```
27
+
The action can then be compiled into a JAR file for use with the runtime for Kotlin. As the action has a dependency on the [Google GSON library](https://github.com/google/gson), it needs to be available on the classpath:
0 commit comments