Debian Codegraph @

go/svc/localhost/v1/localhostv1connect/service.connect.go

raw symbols SCIP
1 // Code generated by protoc-gen-connect-go. DO NOT EDIT.
2 //
3 // Source: svc/localhost/v1/service.proto
4
5 package localhostv1connect
6
7 import (
8 connect "connectrpc.com/connect"
9 context "context"
10 errors "errors"
11 v1 "github.com/humanlogio/api/go/svc/localhost/v1"
12 http "net/http"
13 strings "strings"
14 )
15
16 // This is a compile-time assertion to ensure that this generated file and the connect package are
17 // compatible. If you get a compiler error that this constant is not defined, this code was
18 // generated with a version of connect newer than the one compiled into your binary. You can fix the
19 // problem by either regenerating this code with an older version of connect or updating the connect
20 // version compiled into your binary.
21 const _ = connect.IsAtLeastVersion1_13_0
22
23 const (
24 // LocalhostServiceName is the fully-qualified name of the LocalhostService service.
25 LocalhostServiceName = "svc.localhost.v1.LocalhostService"
26 )
27
28 // These constants are the fully-qualified names of the RPCs defined in this package. They're
29 // exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
30 //
31 // Note that these are different from the fully-qualified method names used by
32 // google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
33 // reflection-formatted method names, remove the leading slash and convert the remaining slash to a
34 // period.
35 const (
36 // LocalhostServicePingProcedure is the fully-qualified name of the LocalhostService's Ping RPC.
37 LocalhostServicePingProcedure = "/svc.localhost.v1.LocalhostService/Ping"
38 // LocalhostServiceDoLoginProcedure is the fully-qualified name of the LocalhostService's DoLogin
39 // RPC.
40 LocalhostServiceDoLoginProcedure = "/svc.localhost.v1.LocalhostService/DoLogin"
41 // LocalhostServiceDoLogoutProcedure is the fully-qualified name of the LocalhostService's DoLogout
42 // RPC.
43 LocalhostServiceDoLogoutProcedure = "/svc.localhost.v1.LocalhostService/DoLogout"
44 // LocalhostServiceDoUpdateProcedure is the fully-qualified name of the LocalhostService's DoUpdate
45 // RPC.
46 LocalhostServiceDoUpdateProcedure = "/svc.localhost.v1.LocalhostService/DoUpdate"
47 // LocalhostServiceDoRestartProcedure is the fully-qualified name of the LocalhostService's
48 // DoRestart RPC.
49 LocalhostServiceDoRestartProcedure = "/svc.localhost.v1.LocalhostService/DoRestart"
50 // LocalhostServiceGetConfigProcedure is the fully-qualified name of the LocalhostService's
51 // GetConfig RPC.
52 LocalhostServiceGetConfigProcedure = "/svc.localhost.v1.LocalhostService/GetConfig"
53 // LocalhostServiceSetConfigProcedure is the fully-qualified name of the LocalhostService's
54 // SetConfig RPC.
55 LocalhostServiceSetConfigProcedure = "/svc.localhost.v1.LocalhostService/SetConfig"
56 )
57
58 // LocalhostServiceClient is a client for the svc.localhost.v1.LocalhostService service.
59 type LocalhostServiceClient interface {
60 Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error)
61 DoLogin(context.Context, *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error)
62 DoLogout(context.Context, *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error)
63 DoUpdate(context.Context, *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error)
64 DoRestart(context.Context, *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error)
65 GetConfig(context.Context, *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error)
66 SetConfig(context.Context, *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error)
67 }
68
69 // NewLocalhostServiceClient constructs a client for the svc.localhost.v1.LocalhostService service.
70 // By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped
71 // responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
72 // connect.WithGRPC() or connect.WithGRPCWeb() options.
73 //
74 // The URL supplied here should be the base URL for the Connect or gRPC server (for example,
75 // http://api.acme.com or https://acme.com/grpc).
76 func NewLocalhostServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) LocalhostServiceClient {
77 baseURL = strings.TrimRight(baseURL, "/")
78 localhostServiceMethods := v1.File_svc_localhost_v1_service_proto.Services().ByName("LocalhostService").Methods()
79 return &localhostServiceClient{
80 ping: connect.NewClient[v1.PingRequest, v1.PingResponse](
81 httpClient,
82 baseURL+LocalhostServicePingProcedure,
83 connect.WithSchema(localhostServiceMethods.ByName("Ping")),
84 connect.WithClientOptions(opts...),
85 ),
86 doLogin: connect.NewClient[v1.DoLoginRequest, v1.DoLoginResponse](
87 httpClient,
88 baseURL+LocalhostServiceDoLoginProcedure,
89 connect.WithSchema(localhostServiceMethods.ByName("DoLogin")),
90 connect.WithClientOptions(opts...),
91 ),
92 doLogout: connect.NewClient[v1.DoLogoutRequest, v1.DoLogoutResponse](
93 httpClient,
94 baseURL+LocalhostServiceDoLogoutProcedure,
95 connect.WithSchema(localhostServiceMethods.ByName("DoLogout")),
96 connect.WithClientOptions(opts...),
97 ),
98 doUpdate: connect.NewClient[v1.DoUpdateRequest, v1.DoUpdateResponse](
99 httpClient,
100 baseURL+LocalhostServiceDoUpdateProcedure,
101 connect.WithSchema(localhostServiceMethods.ByName("DoUpdate")),
102 connect.WithClientOptions(opts...),
103 ),
104 doRestart: connect.NewClient[v1.DoRestartRequest, v1.DoRestartResponse](
105 httpClient,
106 baseURL+LocalhostServiceDoRestartProcedure,
107 connect.WithSchema(localhostServiceMethods.ByName("DoRestart")),
108 connect.WithClientOptions(opts...),
109 ),
110 getConfig: connect.NewClient[v1.GetConfigRequest, v1.GetConfigResponse](
111 httpClient,
112 baseURL+LocalhostServiceGetConfigProcedure,
113 connect.WithSchema(localhostServiceMethods.ByName("GetConfig")),
114 connect.WithClientOptions(opts...),
115 ),
116 setConfig: connect.NewClient[v1.SetConfigRequest, v1.SetConfigResponse](
117 httpClient,
118 baseURL+LocalhostServiceSetConfigProcedure,
119 connect.WithSchema(localhostServiceMethods.ByName("SetConfig")),
120 connect.WithClientOptions(opts...),
121 ),
122 }
123 }
124
125 // localhostServiceClient implements LocalhostServiceClient.
126 type localhostServiceClient struct {
127 ping *connect.Client[v1.PingRequest, v1.PingResponse]
128 doLogin *connect.Client[v1.DoLoginRequest, v1.DoLoginResponse]
129 doLogout *connect.Client[v1.DoLogoutRequest, v1.DoLogoutResponse]
130 doUpdate *connect.Client[v1.DoUpdateRequest, v1.DoUpdateResponse]
131 doRestart *connect.Client[v1.DoRestartRequest, v1.DoRestartResponse]
132 getConfig *connect.Client[v1.GetConfigRequest, v1.GetConfigResponse]
133 setConfig *connect.Client[v1.SetConfigRequest, v1.SetConfigResponse]
134 }
135
136 // Ping calls svc.localhost.v1.LocalhostService.Ping.
137 func (c *localhostServiceClient) Ping(ctx context.Context, req *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error) {
138 return c.ping.CallUnary(ctx, req)
139 }
140
141 // DoLogin calls svc.localhost.v1.LocalhostService.DoLogin.
142 func (c *localhostServiceClient) DoLogin(ctx context.Context, req *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error) {
143 return c.doLogin.CallUnary(ctx, req)
144 }
145
146 // DoLogout calls svc.localhost.v1.LocalhostService.DoLogout.
147 func (c *localhostServiceClient) DoLogout(ctx context.Context, req *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error) {
148 return c.doLogout.CallUnary(ctx, req)
149 }
150
151 // DoUpdate calls svc.localhost.v1.LocalhostService.DoUpdate.
152 func (c *localhostServiceClient) DoUpdate(ctx context.Context, req *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error) {
153 return c.doUpdate.CallUnary(ctx, req)
154 }
155
156 // DoRestart calls svc.localhost.v1.LocalhostService.DoRestart.
157 func (c *localhostServiceClient) DoRestart(ctx context.Context, req *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error) {
158 return c.doRestart.CallUnary(ctx, req)
159 }
160
161 // GetConfig calls svc.localhost.v1.LocalhostService.GetConfig.
162 func (c *localhostServiceClient) GetConfig(ctx context.Context, req *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error) {
163 return c.getConfig.CallUnary(ctx, req)
164 }
165
166 // SetConfig calls svc.localhost.v1.LocalhostService.SetConfig.
167 func (c *localhostServiceClient) SetConfig(ctx context.Context, req *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error) {
168 return c.setConfig.CallUnary(ctx, req)
169 }
170
171 // LocalhostServiceHandler is an implementation of the svc.localhost.v1.LocalhostService service.
172 type LocalhostServiceHandler interface {
173 Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error)
174 DoLogin(context.Context, *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error)
175 DoLogout(context.Context, *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error)
176 DoUpdate(context.Context, *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error)
177 DoRestart(context.Context, *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error)
178 GetConfig(context.Context, *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error)
179 SetConfig(context.Context, *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error)
180 }
181
182 // NewLocalhostServiceHandler builds an HTTP handler from the service implementation. It returns the
183 // path on which to mount the handler and the handler itself.
184 //
185 // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
186 // and JSON codecs. They also support gzip compression.
187 func NewLocalhostServiceHandler(svc LocalhostServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
188 localhostServiceMethods := v1.File_svc_localhost_v1_service_proto.Services().ByName("LocalhostService").Methods()
189 localhostServicePingHandler := connect.NewUnaryHandler(
190 LocalhostServicePingProcedure,
191 svc.Ping,
192 connect.WithSchema(localhostServiceMethods.ByName("Ping")),
193 connect.WithHandlerOptions(opts...),
194 )
195 localhostServiceDoLoginHandler := connect.NewUnaryHandler(
196 LocalhostServiceDoLoginProcedure,
197 svc.DoLogin,
198 connect.WithSchema(localhostServiceMethods.ByName("DoLogin")),
199 connect.WithHandlerOptions(opts...),
200 )
201 localhostServiceDoLogoutHandler := connect.NewUnaryHandler(
202 LocalhostServiceDoLogoutProcedure,
203 svc.DoLogout,
204 connect.WithSchema(localhostServiceMethods.ByName("DoLogout")),
205 connect.WithHandlerOptions(opts...),
206 )
207 localhostServiceDoUpdateHandler := connect.NewUnaryHandler(
208 LocalhostServiceDoUpdateProcedure,
209 svc.DoUpdate,
210 connect.WithSchema(localhostServiceMethods.ByName("DoUpdate")),
211 connect.WithHandlerOptions(opts...),
212 )
213 localhostServiceDoRestartHandler := connect.NewUnaryHandler(
214 LocalhostServiceDoRestartProcedure,
215 svc.DoRestart,
216 connect.WithSchema(localhostServiceMethods.ByName("DoRestart")),
217 connect.WithHandlerOptions(opts...),
218 )
219 localhostServiceGetConfigHandler := connect.NewUnaryHandler(
220 LocalhostServiceGetConfigProcedure,
221 svc.GetConfig,
222 connect.WithSchema(localhostServiceMethods.ByName("GetConfig")),
223 connect.WithHandlerOptions(opts...),
224 )
225 localhostServiceSetConfigHandler := connect.NewUnaryHandler(
226 LocalhostServiceSetConfigProcedure,
227 svc.SetConfig,
228 connect.WithSchema(localhostServiceMethods.ByName("SetConfig")),
229 connect.WithHandlerOptions(opts...),
230 )
231 return "/svc.localhost.v1.LocalhostService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
232 switch r.URL.Path {
233 case LocalhostServicePingProcedure:
234 localhostServicePingHandler.ServeHTTP(w, r)
235 case LocalhostServiceDoLoginProcedure:
236 localhostServiceDoLoginHandler.ServeHTTP(w, r)
237 case LocalhostServiceDoLogoutProcedure:
238 localhostServiceDoLogoutHandler.ServeHTTP(w, r)
239 case LocalhostServiceDoUpdateProcedure:
240 localhostServiceDoUpdateHandler.ServeHTTP(w, r)
241 case LocalhostServiceDoRestartProcedure:
242 localhostServiceDoRestartHandler.ServeHTTP(w, r)
243 case LocalhostServiceGetConfigProcedure:
244 localhostServiceGetConfigHandler.ServeHTTP(w, r)
245 case LocalhostServiceSetConfigProcedure:
246 localhostServiceSetConfigHandler.ServeHTTP(w, r)
247 default:
248 http.NotFound(w, r)
249 }
250 })
251 }
252
253 // UnimplementedLocalhostServiceHandler returns CodeUnimplemented from all methods.
254 type UnimplementedLocalhostServiceHandler struct{}
255
256 func (UnimplementedLocalhostServiceHandler) Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error) {
257 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.Ping is not implemented"))
258 }
259
260 func (UnimplementedLocalhostServiceHandler) DoLogin(context.Context, *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error) {
261 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoLogin is not implemented"))
262 }
263
264 func (UnimplementedLocalhostServiceHandler) DoLogout(context.Context, *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error) {
265 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoLogout is not implemented"))
266 }
267
268 func (UnimplementedLocalhostServiceHandler) DoUpdate(context.Context, *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error) {
269 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoUpdate is not implemented"))
270 }
271
272 func (UnimplementedLocalhostServiceHandler) DoRestart(context.Context, *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error) {
273 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoRestart is not implemented"))
274 }
275
276 func (UnimplementedLocalhostServiceHandler) GetConfig(context.Context, *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error) {
277 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.GetConfig is not implemented"))
278 }
279
280 func (UnimplementedLocalhostServiceHandler) SetConfig(context.Context, *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error) {
281 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.SetConfig is not implemented"))
282 }