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
The action is mainly composed by a `main` function that accepts a JSON `serdes Value` as input and returns a `Result` including a JSON `serde Value`.
64
64
65
+
For the return result, not only support `A JSON serde Value` but also support `Array serde Value`
66
+
67
+
So a simple `hello array` funtion would be:
68
+
69
+
```rust
70
+
externcrate serde_json;
71
+
72
+
useserde_derive::{Deserialize, Serialize};
73
+
useserde_json::{Error, Value};
74
+
75
+
76
+
pubfnmain(args:Value) ->Result<Value, Error> {
77
+
letoutput= ["a", "b"];
78
+
serde_json::to_value(output)
79
+
}
80
+
```
81
+
82
+
And support array result for sequence action as well, the first action's array result can be used as next action's input parameter.
83
+
84
+
So the function can be:
85
+
86
+
```rust
87
+
externcrate serde_json;
88
+
89
+
useserde_derive::{Deserialize, Serialize};
90
+
useserde_json::{Error, Value};
91
+
92
+
93
+
pubfnmain(args:Value) ->Result<Value, Error> {
94
+
let inputParam =args.as_array();
95
+
let defaultOutput = ["c", "d"];
96
+
match inputParam {
97
+
None=>serde_json::to_value(defaultOutput),
98
+
Some(x) =>serde_json::to_value(x),
99
+
}
100
+
}
101
+
```
65
102
### Managing dependencies
66
103
67
104
If your action needs external dependencies, you need to provide a zip file including your source, and your cargo file with all your dependencies. The folder structure is the following:
0 commit comments