Repository navigation
Expand file tree
/
Copy pathaction_gateway.go
More file actions
85 lines (75 loc) · 2.46 KB
/
Copy pathaction_gateway.go
File metadata and controls
85 lines (75 loc) · 2.46 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package godo
import (
"context"
"net/url"
"strings"
)
const actionGatewayPath = "/v2/action-gateway"
// ActionGatewayService groups the public Action Gateway control-plane resources.
type ActionGatewayService struct {
Tools *ActionGatewayToolsService
Toolbelts *ActionGatewayToolbeltsService
OutputViews *ActionGatewayOutputViewsService
MCPServers *ActionGatewayMCPServersService
Connections *ActionGatewayConnectionsService
Sessions *ActionGatewaySessionsService
Users *ActionGatewayUsersService
ActorLimits *ActionGatewayActorLimitsService
}
func newActionGatewayService(client *Client) *ActionGatewayService {
return &ActionGatewayService{
Tools: &ActionGatewayToolsService{client},
Toolbelts: &ActionGatewayToolbeltsService{client},
OutputViews: &ActionGatewayOutputViewsService{client},
MCPServers: &ActionGatewayMCPServersService{client},
Connections: &ActionGatewayConnectionsService{client},
Sessions: &ActionGatewaySessionsService{client},
Users: &ActionGatewayUsersService{client},
ActorLimits: &ActionGatewayActorLimitsService{client},
}
}
func actionGatewayRequest[T any](ctx context.Context, client *Client, method, path string, options, body interface{}) (*T, *Response, error) {
if options != nil {
var err error
path, err = addOptions(path, options)
if err != nil {
return nil, nil, err
}
}
request, err := client.NewRequest(ctx, method, path, body)
if err != nil {
return nil, nil, err
}
result := new(T)
response, err := client.Do(ctx, request, result)
if err != nil {
return nil, response, err
}
return result, response, nil
}
type actionGatewayPathPart struct {
name string
value string
}
func actionGatewayItem(path string, part actionGatewayPathPart) (string, error) {
if strings.TrimSpace(part.value) == "" {
return "", NewArgError(part.name, "cannot be empty")
}
return path + "/" + url.PathEscape(part.value), nil
}
// ActionGatewayPagination describes offset-based list results.
type ActionGatewayPagination struct {
Page int `json:"page"`
PerPage int `json:"per_page"`
Total int `json:"total"`
}
// ActionGatewayListOptions selects an offset-based page.
type ActionGatewayListOptions struct {
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
}
// ActionGatewayCursorOptions selects an opaque cursor-based page.
type ActionGatewayCursorOptions struct {
PageSize int `url:"page_size,omitempty"`
PageToken string `url:"page_token,omitempty"`
}