-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
69 lines (54 loc) · 2.29 KB
/
api.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package api
import (
"context"
"github.com/RussellLuo/orchestrator"
)
//go:generate kungen ./api.go Service
type Service interface {
//kun:op GET /tools
//kun:param __ in=header name=Authorization required=true
GetTools(ctx context.Context) (groups []string, tools map[string][]Tool, err error)
//kun:op PUT /tools/{group}
//kun:param __ in=header name=Authorization required=true
UpsertTool(ctx context.Context, group, typ string, tool Tool) (err error)
//kun:op DELETE /tools/{group}
//kun:param __ in=header name=Authorization required=true
DeleteTool(ctx context.Context, group, typ string) (err error)
//kun:op PUT /flows/{name}
//kun:param __ in=header name=Authorization required=true
//kun:body definition
UpsertFlow(ctx context.Context, name string, definition map[string]any) (err error)
//kun:op DELETE /flows/{name}
//kun:param __ in=header name=Authorization required=true
DeleteFlow(ctx context.Context, name string) (err error)
//kun:op GET /flows/{name}
//kun:param __ in=header name=Authorization required=true
GetFlow(ctx context.Context, name string) (definition map[string]any, err error)
//kun:op GET /schemas
//kun:param __ in=header name=Authorization required=true
GetSchemas(ctx context.Context) (schemas map[string]any, err error)
//kun:op POST /flows/{name}:run
//kun:param __ in=header name=Authorization required=true
//kun:body input
//kun:success body=output
RunFlow(ctx context.Context, name string, input map[string]any) (output map[string]any, err error)
//kun:op POST /flows/{name}:test
//kun:param __ in=header name=Authorization required=true
//kun:body input
//kun:success body=event
TestFlow(ctx context.Context, name string, input map[string]any) (event orchestrator.Event, err error)
//kun:op POST /actors/{id}:resume
//kun:param __ in=header name=Authorization required=true
//kun:body input
//kun:success body=output
ResumeActor(ctx context.Context, id string, input map[string]any) (output map[string]any, err error)
//kun:op POST /actors/{id}:stop
//kun:param __ in=header name=Authorization required=true
//kun:body input
//kun:success statusCode=204 body=output
StopActor(ctx context.Context, id string, input map[string]any) (output map[string]any, err error)
}
type Tool struct {
Type string `json:"type"`
Name string `json:"name"`
}