forked from citilinkru/camunda-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
complete.go
48 lines (39 loc) · 1019 Bytes
/
complete.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
camunda_client_go "github.com/citilinkru/camunda-client-go"
"os"
"time"
)
func main() {
client := camunda_client_go.NewClient(camunda_client_go.ClientOptions{
EndpointUrl: "http://localhost:8080/engine-rest",
ApiUser: "demo",
ApiPassword: "demo",
Timeout: time.Second * 10,
})
query := camunda_client_go.UserTaskGetListQuery{
CreatedAfter: time.Now().Add(-500 * time.Hour),
}
cnt, err := client.UserTask.GetListCount(&query)
if err != nil {
fmt.Printf("Can't get task list count: %s", err)
os.Exit(1)
}
fmt.Printf("total task count: %d\n", cnt)
tasks, err := client.UserTask.GetList(&query)
if err != nil {
fmt.Printf("Can't get task list: %s", err)
os.Exit(1)
}
for i, taks := range tasks {
fmt.Printf("%02d. UserTask: %s - %s - ", i+1, taks.Id, taks.Name)
err = taks.Complete(camunda_client_go.QueryUserTaskComplete{})
if err != nil {
fmt.Printf("ERROR: %s", err)
} else {
fmt.Printf("Complete")
}
fmt.Printf("\n")
}
}