-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.connect.go
262 lines (234 loc) · 15 KB
/
api.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
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: neutral_diet/food/v1/api.proto
package foodv1connect
import (
context "context"
errors "errors"
connect_go "github.com/bufbuild/connect-go"
v1 "github.com/ram02z/neutral_diet/internal/gen/idl/neutral_diet/food/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_go.IsAtLeastVersion0_1_0
const (
// FoodServiceName is the fully-qualified name of the FoodService service.
FoodServiceName = "neutral_diet.food.v1.FoodService"
)
// FoodServiceClient is a client for the neutral_diet.food.v1.FoodService service.
type FoodServiceClient interface {
CreateLifeCycle(context.Context, *connect_go.Request[v1.CreateLifeCycleRequest]) (*connect_go.Response[v1.CreateLifeCycleResponse], error)
CreateFoodItem(context.Context, *connect_go.Request[v1.CreateFoodItemRequest]) (*connect_go.Response[v1.CreateFoodItemResponse], error)
CreateTypology(context.Context, *connect_go.Request[v1.CreateTypologyRequest]) (*connect_go.Response[v1.CreateTypologyResponse], error)
ListTypologyNames(context.Context, *connect_go.Request[v1.ListTypologyNamesRequest]) (*connect_go.Response[v1.ListTypologyNamesResponse], error)
ListSubTypologyNames(context.Context, *connect_go.Request[v1.ListSubTypologyNamesRequest]) (*connect_go.Response[v1.ListSubTypologyNamesResponse], error)
CreateSubTypology(context.Context, *connect_go.Request[v1.CreateSubTypologyRequest]) (*connect_go.Response[v1.CreateSubTypologyResponse], error)
CreateSource(context.Context, *connect_go.Request[v1.CreateSourceRequest]) (*connect_go.Response[v1.CreateSourceResponse], error)
ListAggregateFoodItems(context.Context, *connect_go.Request[v1.ListAggregateFoodItemsRequest]) (*connect_go.Response[v1.ListAggregateFoodItemsResponse], error)
GetFoodItemInfo(context.Context, *connect_go.Request[v1.GetFoodItemInfoRequest]) (*connect_go.Response[v1.GetFoodItemInfoResponse], error)
}
// NewFoodServiceClient constructs a client for the neutral_diet.food.v1.FoodService 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 NewFoodServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) FoodServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &foodServiceClient{
createLifeCycle: connect_go.NewClient[v1.CreateLifeCycleRequest, v1.CreateLifeCycleResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/CreateLifeCycle",
opts...,
),
createFoodItem: connect_go.NewClient[v1.CreateFoodItemRequest, v1.CreateFoodItemResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/CreateFoodItem",
opts...,
),
createTypology: connect_go.NewClient[v1.CreateTypologyRequest, v1.CreateTypologyResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/CreateTypology",
opts...,
),
listTypologyNames: connect_go.NewClient[v1.ListTypologyNamesRequest, v1.ListTypologyNamesResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/ListTypologyNames",
opts...,
),
listSubTypologyNames: connect_go.NewClient[v1.ListSubTypologyNamesRequest, v1.ListSubTypologyNamesResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/ListSubTypologyNames",
opts...,
),
createSubTypology: connect_go.NewClient[v1.CreateSubTypologyRequest, v1.CreateSubTypologyResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/CreateSubTypology",
opts...,
),
createSource: connect_go.NewClient[v1.CreateSourceRequest, v1.CreateSourceResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/CreateSource",
opts...,
),
listAggregateFoodItems: connect_go.NewClient[v1.ListAggregateFoodItemsRequest, v1.ListAggregateFoodItemsResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/ListAggregateFoodItems",
opts...,
),
getFoodItemInfo: connect_go.NewClient[v1.GetFoodItemInfoRequest, v1.GetFoodItemInfoResponse](
httpClient,
baseURL+"/neutral_diet.food.v1.FoodService/GetFoodItemInfo",
opts...,
),
}
}
// foodServiceClient implements FoodServiceClient.
type foodServiceClient struct {
createLifeCycle *connect_go.Client[v1.CreateLifeCycleRequest, v1.CreateLifeCycleResponse]
createFoodItem *connect_go.Client[v1.CreateFoodItemRequest, v1.CreateFoodItemResponse]
createTypology *connect_go.Client[v1.CreateTypologyRequest, v1.CreateTypologyResponse]
listTypologyNames *connect_go.Client[v1.ListTypologyNamesRequest, v1.ListTypologyNamesResponse]
listSubTypologyNames *connect_go.Client[v1.ListSubTypologyNamesRequest, v1.ListSubTypologyNamesResponse]
createSubTypology *connect_go.Client[v1.CreateSubTypologyRequest, v1.CreateSubTypologyResponse]
createSource *connect_go.Client[v1.CreateSourceRequest, v1.CreateSourceResponse]
listAggregateFoodItems *connect_go.Client[v1.ListAggregateFoodItemsRequest, v1.ListAggregateFoodItemsResponse]
getFoodItemInfo *connect_go.Client[v1.GetFoodItemInfoRequest, v1.GetFoodItemInfoResponse]
}
// CreateLifeCycle calls neutral_diet.food.v1.FoodService.CreateLifeCycle.
func (c *foodServiceClient) CreateLifeCycle(ctx context.Context, req *connect_go.Request[v1.CreateLifeCycleRequest]) (*connect_go.Response[v1.CreateLifeCycleResponse], error) {
return c.createLifeCycle.CallUnary(ctx, req)
}
// CreateFoodItem calls neutral_diet.food.v1.FoodService.CreateFoodItem.
func (c *foodServiceClient) CreateFoodItem(ctx context.Context, req *connect_go.Request[v1.CreateFoodItemRequest]) (*connect_go.Response[v1.CreateFoodItemResponse], error) {
return c.createFoodItem.CallUnary(ctx, req)
}
// CreateTypology calls neutral_diet.food.v1.FoodService.CreateTypology.
func (c *foodServiceClient) CreateTypology(ctx context.Context, req *connect_go.Request[v1.CreateTypologyRequest]) (*connect_go.Response[v1.CreateTypologyResponse], error) {
return c.createTypology.CallUnary(ctx, req)
}
// ListTypologyNames calls neutral_diet.food.v1.FoodService.ListTypologyNames.
func (c *foodServiceClient) ListTypologyNames(ctx context.Context, req *connect_go.Request[v1.ListTypologyNamesRequest]) (*connect_go.Response[v1.ListTypologyNamesResponse], error) {
return c.listTypologyNames.CallUnary(ctx, req)
}
// ListSubTypologyNames calls neutral_diet.food.v1.FoodService.ListSubTypologyNames.
func (c *foodServiceClient) ListSubTypologyNames(ctx context.Context, req *connect_go.Request[v1.ListSubTypologyNamesRequest]) (*connect_go.Response[v1.ListSubTypologyNamesResponse], error) {
return c.listSubTypologyNames.CallUnary(ctx, req)
}
// CreateSubTypology calls neutral_diet.food.v1.FoodService.CreateSubTypology.
func (c *foodServiceClient) CreateSubTypology(ctx context.Context, req *connect_go.Request[v1.CreateSubTypologyRequest]) (*connect_go.Response[v1.CreateSubTypologyResponse], error) {
return c.createSubTypology.CallUnary(ctx, req)
}
// CreateSource calls neutral_diet.food.v1.FoodService.CreateSource.
func (c *foodServiceClient) CreateSource(ctx context.Context, req *connect_go.Request[v1.CreateSourceRequest]) (*connect_go.Response[v1.CreateSourceResponse], error) {
return c.createSource.CallUnary(ctx, req)
}
// ListAggregateFoodItems calls neutral_diet.food.v1.FoodService.ListAggregateFoodItems.
func (c *foodServiceClient) ListAggregateFoodItems(ctx context.Context, req *connect_go.Request[v1.ListAggregateFoodItemsRequest]) (*connect_go.Response[v1.ListAggregateFoodItemsResponse], error) {
return c.listAggregateFoodItems.CallUnary(ctx, req)
}
// GetFoodItemInfo calls neutral_diet.food.v1.FoodService.GetFoodItemInfo.
func (c *foodServiceClient) GetFoodItemInfo(ctx context.Context, req *connect_go.Request[v1.GetFoodItemInfoRequest]) (*connect_go.Response[v1.GetFoodItemInfoResponse], error) {
return c.getFoodItemInfo.CallUnary(ctx, req)
}
// FoodServiceHandler is an implementation of the neutral_diet.food.v1.FoodService service.
type FoodServiceHandler interface {
CreateLifeCycle(context.Context, *connect_go.Request[v1.CreateLifeCycleRequest]) (*connect_go.Response[v1.CreateLifeCycleResponse], error)
CreateFoodItem(context.Context, *connect_go.Request[v1.CreateFoodItemRequest]) (*connect_go.Response[v1.CreateFoodItemResponse], error)
CreateTypology(context.Context, *connect_go.Request[v1.CreateTypologyRequest]) (*connect_go.Response[v1.CreateTypologyResponse], error)
ListTypologyNames(context.Context, *connect_go.Request[v1.ListTypologyNamesRequest]) (*connect_go.Response[v1.ListTypologyNamesResponse], error)
ListSubTypologyNames(context.Context, *connect_go.Request[v1.ListSubTypologyNamesRequest]) (*connect_go.Response[v1.ListSubTypologyNamesResponse], error)
CreateSubTypology(context.Context, *connect_go.Request[v1.CreateSubTypologyRequest]) (*connect_go.Response[v1.CreateSubTypologyResponse], error)
CreateSource(context.Context, *connect_go.Request[v1.CreateSourceRequest]) (*connect_go.Response[v1.CreateSourceResponse], error)
ListAggregateFoodItems(context.Context, *connect_go.Request[v1.ListAggregateFoodItemsRequest]) (*connect_go.Response[v1.ListAggregateFoodItemsResponse], error)
GetFoodItemInfo(context.Context, *connect_go.Request[v1.GetFoodItemInfoRequest]) (*connect_go.Response[v1.GetFoodItemInfoResponse], error)
}
// NewFoodServiceHandler 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 NewFoodServiceHandler(svc FoodServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
mux := http.NewServeMux()
mux.Handle("/neutral_diet.food.v1.FoodService/CreateLifeCycle", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/CreateLifeCycle",
svc.CreateLifeCycle,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/CreateFoodItem", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/CreateFoodItem",
svc.CreateFoodItem,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/CreateTypology", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/CreateTypology",
svc.CreateTypology,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/ListTypologyNames", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/ListTypologyNames",
svc.ListTypologyNames,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/ListSubTypologyNames", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/ListSubTypologyNames",
svc.ListSubTypologyNames,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/CreateSubTypology", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/CreateSubTypology",
svc.CreateSubTypology,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/CreateSource", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/CreateSource",
svc.CreateSource,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/ListAggregateFoodItems", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/ListAggregateFoodItems",
svc.ListAggregateFoodItems,
opts...,
))
mux.Handle("/neutral_diet.food.v1.FoodService/GetFoodItemInfo", connect_go.NewUnaryHandler(
"/neutral_diet.food.v1.FoodService/GetFoodItemInfo",
svc.GetFoodItemInfo,
opts...,
))
return "/neutral_diet.food.v1.FoodService/", mux
}
// UnimplementedFoodServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedFoodServiceHandler struct{}
func (UnimplementedFoodServiceHandler) CreateLifeCycle(context.Context, *connect_go.Request[v1.CreateLifeCycleRequest]) (*connect_go.Response[v1.CreateLifeCycleResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.CreateLifeCycle is not implemented"))
}
func (UnimplementedFoodServiceHandler) CreateFoodItem(context.Context, *connect_go.Request[v1.CreateFoodItemRequest]) (*connect_go.Response[v1.CreateFoodItemResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.CreateFoodItem is not implemented"))
}
func (UnimplementedFoodServiceHandler) CreateTypology(context.Context, *connect_go.Request[v1.CreateTypologyRequest]) (*connect_go.Response[v1.CreateTypologyResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.CreateTypology is not implemented"))
}
func (UnimplementedFoodServiceHandler) ListTypologyNames(context.Context, *connect_go.Request[v1.ListTypologyNamesRequest]) (*connect_go.Response[v1.ListTypologyNamesResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.ListTypologyNames is not implemented"))
}
func (UnimplementedFoodServiceHandler) ListSubTypologyNames(context.Context, *connect_go.Request[v1.ListSubTypologyNamesRequest]) (*connect_go.Response[v1.ListSubTypologyNamesResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.ListSubTypologyNames is not implemented"))
}
func (UnimplementedFoodServiceHandler) CreateSubTypology(context.Context, *connect_go.Request[v1.CreateSubTypologyRequest]) (*connect_go.Response[v1.CreateSubTypologyResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.CreateSubTypology is not implemented"))
}
func (UnimplementedFoodServiceHandler) CreateSource(context.Context, *connect_go.Request[v1.CreateSourceRequest]) (*connect_go.Response[v1.CreateSourceResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.CreateSource is not implemented"))
}
func (UnimplementedFoodServiceHandler) ListAggregateFoodItems(context.Context, *connect_go.Request[v1.ListAggregateFoodItemsRequest]) (*connect_go.Response[v1.ListAggregateFoodItemsResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.ListAggregateFoodItems is not implemented"))
}
func (UnimplementedFoodServiceHandler) GetFoodItemInfo(context.Context, *connect_go.Request[v1.GetFoodItemInfoRequest]) (*connect_go.Response[v1.GetFoodItemInfoResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("neutral_diet.food.v1.FoodService.GetFoodItemInfo is not implemented"))
}