-
Notifications
You must be signed in to change notification settings - Fork 2
/
svc.connect.go
281 lines (256 loc) · 14.7 KB
/
svc.connect.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: autokitteh/integrations/v1/svc.proto
package integrationsv1connect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
v1 "go.autokitteh.dev/autokitteh/proto/gen/go/autokitteh/integrations/v1"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion0_1_0
const (
// IntegrationsServiceName is the fully-qualified name of the IntegrationsService service.
IntegrationsServiceName = "autokitteh.integrations.v1.IntegrationsService"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// IntegrationsServiceGetProcedure is the fully-qualified name of the IntegrationsService's Get RPC.
IntegrationsServiceGetProcedure = "/autokitteh.integrations.v1.IntegrationsService/Get"
// IntegrationsServiceListProcedure is the fully-qualified name of the IntegrationsService's List
// RPC.
IntegrationsServiceListProcedure = "/autokitteh.integrations.v1.IntegrationsService/List"
// IntegrationsServiceConfigureProcedure is the fully-qualified name of the IntegrationsService's
// Configure RPC.
IntegrationsServiceConfigureProcedure = "/autokitteh.integrations.v1.IntegrationsService/Configure"
// IntegrationsServiceTestConnectionProcedure is the fully-qualified name of the
// IntegrationsService's TestConnection RPC.
IntegrationsServiceTestConnectionProcedure = "/autokitteh.integrations.v1.IntegrationsService/TestConnection"
// IntegrationsServiceGetConnectionStatusProcedure is the fully-qualified name of the
// IntegrationsService's GetConnectionStatus RPC.
IntegrationsServiceGetConnectionStatusProcedure = "/autokitteh.integrations.v1.IntegrationsService/GetConnectionStatus"
// IntegrationsServiceGetConnectionConfigProcedure is the fully-qualified name of the
// IntegrationsService's GetConnectionConfig RPC.
IntegrationsServiceGetConnectionConfigProcedure = "/autokitteh.integrations.v1.IntegrationsService/GetConnectionConfig"
// IntegrationsServiceCallProcedure is the fully-qualified name of the IntegrationsService's Call
// RPC.
IntegrationsServiceCallProcedure = "/autokitteh.integrations.v1.IntegrationsService/Call"
)
// IntegrationsServiceClient is a client for the autokitteh.integrations.v1.IntegrationsService
// service.
type IntegrationsServiceClient interface {
Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error)
List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
// Get all values for a specific configuration of the integration.
// The returned values ExecutorIDs will be the integration id.
Configure(context.Context, *connect.Request[v1.ConfigureRequest]) (*connect.Response[v1.ConfigureResponse], error)
// Actively test the connection to the integration.
// requires supports_connection_test.
TestConnection(context.Context, *connect.Request[v1.TestConnectionRequest]) (*connect.Response[v1.TestConnectionResponse], error)
// If connection_id is not provided, will return the status of a new connection as
// set in `Integration.initial_connection_status`.
GetConnectionStatus(context.Context, *connect.Request[v1.GetConnectionStatusRequest]) (*connect.Response[v1.GetConnectionStatusResponse], error)
GetConnectionConfig(context.Context, *connect.Request[v1.GetConnectionConfigRequest]) (*connect.Response[v1.GetConnectionConfigResponse], error)
Call(context.Context, *connect.Request[v1.CallRequest]) (*connect.Response[v1.CallResponse], error)
}
// NewIntegrationsServiceClient constructs a client for the
// autokitteh.integrations.v1.IntegrationsService service. By default, it uses the Connect protocol
// with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To
// use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb()
// options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewIntegrationsServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) IntegrationsServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &integrationsServiceClient{
get: connect.NewClient[v1.GetRequest, v1.GetResponse](
httpClient,
baseURL+IntegrationsServiceGetProcedure,
opts...,
),
list: connect.NewClient[v1.ListRequest, v1.ListResponse](
httpClient,
baseURL+IntegrationsServiceListProcedure,
opts...,
),
configure: connect.NewClient[v1.ConfigureRequest, v1.ConfigureResponse](
httpClient,
baseURL+IntegrationsServiceConfigureProcedure,
opts...,
),
testConnection: connect.NewClient[v1.TestConnectionRequest, v1.TestConnectionResponse](
httpClient,
baseURL+IntegrationsServiceTestConnectionProcedure,
opts...,
),
getConnectionStatus: connect.NewClient[v1.GetConnectionStatusRequest, v1.GetConnectionStatusResponse](
httpClient,
baseURL+IntegrationsServiceGetConnectionStatusProcedure,
opts...,
),
getConnectionConfig: connect.NewClient[v1.GetConnectionConfigRequest, v1.GetConnectionConfigResponse](
httpClient,
baseURL+IntegrationsServiceGetConnectionConfigProcedure,
opts...,
),
call: connect.NewClient[v1.CallRequest, v1.CallResponse](
httpClient,
baseURL+IntegrationsServiceCallProcedure,
opts...,
),
}
}
// integrationsServiceClient implements IntegrationsServiceClient.
type integrationsServiceClient struct {
get *connect.Client[v1.GetRequest, v1.GetResponse]
list *connect.Client[v1.ListRequest, v1.ListResponse]
configure *connect.Client[v1.ConfigureRequest, v1.ConfigureResponse]
testConnection *connect.Client[v1.TestConnectionRequest, v1.TestConnectionResponse]
getConnectionStatus *connect.Client[v1.GetConnectionStatusRequest, v1.GetConnectionStatusResponse]
getConnectionConfig *connect.Client[v1.GetConnectionConfigRequest, v1.GetConnectionConfigResponse]
call *connect.Client[v1.CallRequest, v1.CallResponse]
}
// Get calls autokitteh.integrations.v1.IntegrationsService.Get.
func (c *integrationsServiceClient) Get(ctx context.Context, req *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error) {
return c.get.CallUnary(ctx, req)
}
// List calls autokitteh.integrations.v1.IntegrationsService.List.
func (c *integrationsServiceClient) List(ctx context.Context, req *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error) {
return c.list.CallUnary(ctx, req)
}
// Configure calls autokitteh.integrations.v1.IntegrationsService.Configure.
func (c *integrationsServiceClient) Configure(ctx context.Context, req *connect.Request[v1.ConfigureRequest]) (*connect.Response[v1.ConfigureResponse], error) {
return c.configure.CallUnary(ctx, req)
}
// TestConnection calls autokitteh.integrations.v1.IntegrationsService.TestConnection.
func (c *integrationsServiceClient) TestConnection(ctx context.Context, req *connect.Request[v1.TestConnectionRequest]) (*connect.Response[v1.TestConnectionResponse], error) {
return c.testConnection.CallUnary(ctx, req)
}
// GetConnectionStatus calls autokitteh.integrations.v1.IntegrationsService.GetConnectionStatus.
func (c *integrationsServiceClient) GetConnectionStatus(ctx context.Context, req *connect.Request[v1.GetConnectionStatusRequest]) (*connect.Response[v1.GetConnectionStatusResponse], error) {
return c.getConnectionStatus.CallUnary(ctx, req)
}
// GetConnectionConfig calls autokitteh.integrations.v1.IntegrationsService.GetConnectionConfig.
func (c *integrationsServiceClient) GetConnectionConfig(ctx context.Context, req *connect.Request[v1.GetConnectionConfigRequest]) (*connect.Response[v1.GetConnectionConfigResponse], error) {
return c.getConnectionConfig.CallUnary(ctx, req)
}
// Call calls autokitteh.integrations.v1.IntegrationsService.Call.
func (c *integrationsServiceClient) Call(ctx context.Context, req *connect.Request[v1.CallRequest]) (*connect.Response[v1.CallResponse], error) {
return c.call.CallUnary(ctx, req)
}
// IntegrationsServiceHandler is an implementation of the
// autokitteh.integrations.v1.IntegrationsService service.
type IntegrationsServiceHandler interface {
Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error)
List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
// Get all values for a specific configuration of the integration.
// The returned values ExecutorIDs will be the integration id.
Configure(context.Context, *connect.Request[v1.ConfigureRequest]) (*connect.Response[v1.ConfigureResponse], error)
// Actively test the connection to the integration.
// requires supports_connection_test.
TestConnection(context.Context, *connect.Request[v1.TestConnectionRequest]) (*connect.Response[v1.TestConnectionResponse], error)
// If connection_id is not provided, will return the status of a new connection as
// set in `Integration.initial_connection_status`.
GetConnectionStatus(context.Context, *connect.Request[v1.GetConnectionStatusRequest]) (*connect.Response[v1.GetConnectionStatusResponse], error)
GetConnectionConfig(context.Context, *connect.Request[v1.GetConnectionConfigRequest]) (*connect.Response[v1.GetConnectionConfigResponse], error)
Call(context.Context, *connect.Request[v1.CallRequest]) (*connect.Response[v1.CallResponse], error)
}
// NewIntegrationsServiceHandler builds an HTTP handler from the service implementation. It returns
// the path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewIntegrationsServiceHandler(svc IntegrationsServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
integrationsServiceGetHandler := connect.NewUnaryHandler(
IntegrationsServiceGetProcedure,
svc.Get,
opts...,
)
integrationsServiceListHandler := connect.NewUnaryHandler(
IntegrationsServiceListProcedure,
svc.List,
opts...,
)
integrationsServiceConfigureHandler := connect.NewUnaryHandler(
IntegrationsServiceConfigureProcedure,
svc.Configure,
opts...,
)
integrationsServiceTestConnectionHandler := connect.NewUnaryHandler(
IntegrationsServiceTestConnectionProcedure,
svc.TestConnection,
opts...,
)
integrationsServiceGetConnectionStatusHandler := connect.NewUnaryHandler(
IntegrationsServiceGetConnectionStatusProcedure,
svc.GetConnectionStatus,
opts...,
)
integrationsServiceGetConnectionConfigHandler := connect.NewUnaryHandler(
IntegrationsServiceGetConnectionConfigProcedure,
svc.GetConnectionConfig,
opts...,
)
integrationsServiceCallHandler := connect.NewUnaryHandler(
IntegrationsServiceCallProcedure,
svc.Call,
opts...,
)
return "/autokitteh.integrations.v1.IntegrationsService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case IntegrationsServiceGetProcedure:
integrationsServiceGetHandler.ServeHTTP(w, r)
case IntegrationsServiceListProcedure:
integrationsServiceListHandler.ServeHTTP(w, r)
case IntegrationsServiceConfigureProcedure:
integrationsServiceConfigureHandler.ServeHTTP(w, r)
case IntegrationsServiceTestConnectionProcedure:
integrationsServiceTestConnectionHandler.ServeHTTP(w, r)
case IntegrationsServiceGetConnectionStatusProcedure:
integrationsServiceGetConnectionStatusHandler.ServeHTTP(w, r)
case IntegrationsServiceGetConnectionConfigProcedure:
integrationsServiceGetConnectionConfigHandler.ServeHTTP(w, r)
case IntegrationsServiceCallProcedure:
integrationsServiceCallHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedIntegrationsServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedIntegrationsServiceHandler struct{}
func (UnimplementedIntegrationsServiceHandler) Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.Get is not implemented"))
}
func (UnimplementedIntegrationsServiceHandler) List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.List is not implemented"))
}
func (UnimplementedIntegrationsServiceHandler) Configure(context.Context, *connect.Request[v1.ConfigureRequest]) (*connect.Response[v1.ConfigureResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.Configure is not implemented"))
}
func (UnimplementedIntegrationsServiceHandler) TestConnection(context.Context, *connect.Request[v1.TestConnectionRequest]) (*connect.Response[v1.TestConnectionResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.TestConnection is not implemented"))
}
func (UnimplementedIntegrationsServiceHandler) GetConnectionStatus(context.Context, *connect.Request[v1.GetConnectionStatusRequest]) (*connect.Response[v1.GetConnectionStatusResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.GetConnectionStatus is not implemented"))
}
func (UnimplementedIntegrationsServiceHandler) GetConnectionConfig(context.Context, *connect.Request[v1.GetConnectionConfigRequest]) (*connect.Response[v1.GetConnectionConfigResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.GetConnectionConfig is not implemented"))
}
func (UnimplementedIntegrationsServiceHandler) Call(context.Context, *connect.Request[v1.CallRequest]) (*connect.Response[v1.CallResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.integrations.v1.IntegrationsService.Call is not implemented"))
}