// Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: svc/localhost/v1/service.proto package localhostv1connect import ( connect "connectrpc.com/connect" context "context" errors "errors" v1 "github.com/humanlogio/api/go/svc/localhost/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.IsAtLeastVersion1_13_0 const ( // LocalhostServiceName is the fully-qualified name of the LocalhostService service. LocalhostServiceName = "svc.localhost.v1.LocalhostService" ) // 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 ( // LocalhostServicePingProcedure is the fully-qualified name of the LocalhostService's Ping RPC. LocalhostServicePingProcedure = "/svc.localhost.v1.LocalhostService/Ping" // LocalhostServiceDoLoginProcedure is the fully-qualified name of the LocalhostService's DoLogin // RPC. LocalhostServiceDoLoginProcedure = "/svc.localhost.v1.LocalhostService/DoLogin" // LocalhostServiceDoLogoutProcedure is the fully-qualified name of the LocalhostService's DoLogout // RPC. LocalhostServiceDoLogoutProcedure = "/svc.localhost.v1.LocalhostService/DoLogout" // LocalhostServiceDoUpdateProcedure is the fully-qualified name of the LocalhostService's DoUpdate // RPC. LocalhostServiceDoUpdateProcedure = "/svc.localhost.v1.LocalhostService/DoUpdate" // LocalhostServiceDoRestartProcedure is the fully-qualified name of the LocalhostService's // DoRestart RPC. LocalhostServiceDoRestartProcedure = "/svc.localhost.v1.LocalhostService/DoRestart" // LocalhostServiceGetConfigProcedure is the fully-qualified name of the LocalhostService's // GetConfig RPC. LocalhostServiceGetConfigProcedure = "/svc.localhost.v1.LocalhostService/GetConfig" // LocalhostServiceSetConfigProcedure is the fully-qualified name of the LocalhostService's // SetConfig RPC. LocalhostServiceSetConfigProcedure = "/svc.localhost.v1.LocalhostService/SetConfig" ) // LocalhostServiceClient is a client for the svc.localhost.v1.LocalhostService service. type LocalhostServiceClient interface { Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error) DoLogin(context.Context, *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error) DoLogout(context.Context, *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error) DoUpdate(context.Context, *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error) DoRestart(context.Context, *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error) GetConfig(context.Context, *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error) SetConfig(context.Context, *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error) } // NewLocalhostServiceClient constructs a client for the svc.localhost.v1.LocalhostService 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 NewLocalhostServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) LocalhostServiceClient { baseURL = strings.TrimRight(baseURL, "/") localhostServiceMethods := v1.File_svc_localhost_v1_service_proto.Services().ByName("LocalhostService").Methods() return &localhostServiceClient{ ping: connect.NewClient[v1.PingRequest, v1.PingResponse]( httpClient, baseURL+LocalhostServicePingProcedure, connect.WithSchema(localhostServiceMethods.ByName("Ping")), connect.WithClientOptions(opts...), ), doLogin: connect.NewClient[v1.DoLoginRequest, v1.DoLoginResponse]( httpClient, baseURL+LocalhostServiceDoLoginProcedure, connect.WithSchema(localhostServiceMethods.ByName("DoLogin")), connect.WithClientOptions(opts...), ), doLogout: connect.NewClient[v1.DoLogoutRequest, v1.DoLogoutResponse]( httpClient, baseURL+LocalhostServiceDoLogoutProcedure, connect.WithSchema(localhostServiceMethods.ByName("DoLogout")), connect.WithClientOptions(opts...), ), doUpdate: connect.NewClient[v1.DoUpdateRequest, v1.DoUpdateResponse]( httpClient, baseURL+LocalhostServiceDoUpdateProcedure, connect.WithSchema(localhostServiceMethods.ByName("DoUpdate")), connect.WithClientOptions(opts...), ), doRestart: connect.NewClient[v1.DoRestartRequest, v1.DoRestartResponse]( httpClient, baseURL+LocalhostServiceDoRestartProcedure, connect.WithSchema(localhostServiceMethods.ByName("DoRestart")), connect.WithClientOptions(opts...), ), getConfig: connect.NewClient[v1.GetConfigRequest, v1.GetConfigResponse]( httpClient, baseURL+LocalhostServiceGetConfigProcedure, connect.WithSchema(localhostServiceMethods.ByName("GetConfig")), connect.WithClientOptions(opts...), ), setConfig: connect.NewClient[v1.SetConfigRequest, v1.SetConfigResponse]( httpClient, baseURL+LocalhostServiceSetConfigProcedure, connect.WithSchema(localhostServiceMethods.ByName("SetConfig")), connect.WithClientOptions(opts...), ), } } // localhostServiceClient implements LocalhostServiceClient. type localhostServiceClient struct { ping *connect.Client[v1.PingRequest, v1.PingResponse] doLogin *connect.Client[v1.DoLoginRequest, v1.DoLoginResponse] doLogout *connect.Client[v1.DoLogoutRequest, v1.DoLogoutResponse] doUpdate *connect.Client[v1.DoUpdateRequest, v1.DoUpdateResponse] doRestart *connect.Client[v1.DoRestartRequest, v1.DoRestartResponse] getConfig *connect.Client[v1.GetConfigRequest, v1.GetConfigResponse] setConfig *connect.Client[v1.SetConfigRequest, v1.SetConfigResponse] } // Ping calls svc.localhost.v1.LocalhostService.Ping. func (c *localhostServiceClient) Ping(ctx context.Context, req *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error) { return c.ping.CallUnary(ctx, req) } // DoLogin calls svc.localhost.v1.LocalhostService.DoLogin. func (c *localhostServiceClient) DoLogin(ctx context.Context, req *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error) { return c.doLogin.CallUnary(ctx, req) } // DoLogout calls svc.localhost.v1.LocalhostService.DoLogout. func (c *localhostServiceClient) DoLogout(ctx context.Context, req *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error) { return c.doLogout.CallUnary(ctx, req) } // DoUpdate calls svc.localhost.v1.LocalhostService.DoUpdate. func (c *localhostServiceClient) DoUpdate(ctx context.Context, req *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error) { return c.doUpdate.CallUnary(ctx, req) } // DoRestart calls svc.localhost.v1.LocalhostService.DoRestart. func (c *localhostServiceClient) DoRestart(ctx context.Context, req *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error) { return c.doRestart.CallUnary(ctx, req) } // GetConfig calls svc.localhost.v1.LocalhostService.GetConfig. func (c *localhostServiceClient) GetConfig(ctx context.Context, req *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error) { return c.getConfig.CallUnary(ctx, req) } // SetConfig calls svc.localhost.v1.LocalhostService.SetConfig. func (c *localhostServiceClient) SetConfig(ctx context.Context, req *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error) { return c.setConfig.CallUnary(ctx, req) } // LocalhostServiceHandler is an implementation of the svc.localhost.v1.LocalhostService service. type LocalhostServiceHandler interface { Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error) DoLogin(context.Context, *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error) DoLogout(context.Context, *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error) DoUpdate(context.Context, *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error) DoRestart(context.Context, *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error) GetConfig(context.Context, *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error) SetConfig(context.Context, *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error) } // NewLocalhostServiceHandler 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 NewLocalhostServiceHandler(svc LocalhostServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { localhostServiceMethods := v1.File_svc_localhost_v1_service_proto.Services().ByName("LocalhostService").Methods() localhostServicePingHandler := connect.NewUnaryHandler( LocalhostServicePingProcedure, svc.Ping, connect.WithSchema(localhostServiceMethods.ByName("Ping")), connect.WithHandlerOptions(opts...), ) localhostServiceDoLoginHandler := connect.NewUnaryHandler( LocalhostServiceDoLoginProcedure, svc.DoLogin, connect.WithSchema(localhostServiceMethods.ByName("DoLogin")), connect.WithHandlerOptions(opts...), ) localhostServiceDoLogoutHandler := connect.NewUnaryHandler( LocalhostServiceDoLogoutProcedure, svc.DoLogout, connect.WithSchema(localhostServiceMethods.ByName("DoLogout")), connect.WithHandlerOptions(opts...), ) localhostServiceDoUpdateHandler := connect.NewUnaryHandler( LocalhostServiceDoUpdateProcedure, svc.DoUpdate, connect.WithSchema(localhostServiceMethods.ByName("DoUpdate")), connect.WithHandlerOptions(opts...), ) localhostServiceDoRestartHandler := connect.NewUnaryHandler( LocalhostServiceDoRestartProcedure, svc.DoRestart, connect.WithSchema(localhostServiceMethods.ByName("DoRestart")), connect.WithHandlerOptions(opts...), ) localhostServiceGetConfigHandler := connect.NewUnaryHandler( LocalhostServiceGetConfigProcedure, svc.GetConfig, connect.WithSchema(localhostServiceMethods.ByName("GetConfig")), connect.WithHandlerOptions(opts...), ) localhostServiceSetConfigHandler := connect.NewUnaryHandler( LocalhostServiceSetConfigProcedure, svc.SetConfig, connect.WithSchema(localhostServiceMethods.ByName("SetConfig")), connect.WithHandlerOptions(opts...), ) return "/svc.localhost.v1.LocalhostService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case LocalhostServicePingProcedure: localhostServicePingHandler.ServeHTTP(w, r) case LocalhostServiceDoLoginProcedure: localhostServiceDoLoginHandler.ServeHTTP(w, r) case LocalhostServiceDoLogoutProcedure: localhostServiceDoLogoutHandler.ServeHTTP(w, r) case LocalhostServiceDoUpdateProcedure: localhostServiceDoUpdateHandler.ServeHTTP(w, r) case LocalhostServiceDoRestartProcedure: localhostServiceDoRestartHandler.ServeHTTP(w, r) case LocalhostServiceGetConfigProcedure: localhostServiceGetConfigHandler.ServeHTTP(w, r) case LocalhostServiceSetConfigProcedure: localhostServiceSetConfigHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedLocalhostServiceHandler returns CodeUnimplemented from all methods. type UnimplementedLocalhostServiceHandler struct{} func (UnimplementedLocalhostServiceHandler) Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.Ping is not implemented")) } func (UnimplementedLocalhostServiceHandler) DoLogin(context.Context, *connect.Request[v1.DoLoginRequest]) (*connect.Response[v1.DoLoginResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoLogin is not implemented")) } func (UnimplementedLocalhostServiceHandler) DoLogout(context.Context, *connect.Request[v1.DoLogoutRequest]) (*connect.Response[v1.DoLogoutResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoLogout is not implemented")) } func (UnimplementedLocalhostServiceHandler) DoUpdate(context.Context, *connect.Request[v1.DoUpdateRequest]) (*connect.Response[v1.DoUpdateResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoUpdate is not implemented")) } func (UnimplementedLocalhostServiceHandler) DoRestart(context.Context, *connect.Request[v1.DoRestartRequest]) (*connect.Response[v1.DoRestartResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.DoRestart is not implemented")) } func (UnimplementedLocalhostServiceHandler) GetConfig(context.Context, *connect.Request[v1.GetConfigRequest]) (*connect.Response[v1.GetConfigResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.GetConfig is not implemented")) } func (UnimplementedLocalhostServiceHandler) SetConfig(context.Context, *connect.Request[v1.SetConfigRequest]) (*connect.Response[v1.SetConfigResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.localhost.v1.LocalhostService.SetConfig is not implemented")) }