-
Notifications
You must be signed in to change notification settings - Fork 1
/
tool.go
55 lines (45 loc) · 1.88 KB
/
tool.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
package client
// ParameterType determines the data type of a parameter.
type ParameterType string
const (
// ParameterTypeString indicates the parameter accepts string/text values.
ParameterTypeString ParameterType = "string"
)
// BodyEncoding determines how the HTTP body will be encoded.
type BodyEncoding string
const (
// BodyEncodingForm indicates the body will be encoded using URL encoding.
BodyEncodingForm BodyEncoding = "application/x-www-form-urlencoded"
// BodyEncodingJSON indicates the body will be encoded as JSON.
BodyEncodingJSON BodyEncoding = "application/json"
)
type Tool struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Parameters []ToolParameter `json:"parameters"`
Webhook *ToolWebhookConfiguration `json:"webhook,omitempty"`
HTTP *ActionHTTPDefinition `json:"http,omitempty"`
Mock bool `json:"mock,omitempty"`
}
type ToolParameter struct {
Name string `json:"name"`
Description string `json:"description"`
Type ParameterType `json:"type"`
Required *bool `json:"required,omitempty"`
Options []string `json:"options,omitempty"`
}
type ToolWebhookConfiguration struct {
Name string `json:"name"`
}
type ActionHTTPDefinition struct {
Method string `json:"method"`
URLTemplate string `json:"url_template"`
HeaderTemplates map[string]string `json:"header_templates,omitempty"`
Body *ActionHTTPBodyDefinition `json:"body,omitempty"`
}
type ActionHTTPBodyDefinition struct {
Encoding BodyEncoding `json:"encoding"`
JSONTemplate string `json:"json_template,omitempty"`
FormFieldTemplates map[string]string `json:"form_field_templates,omitempty"`
}