Debian Codegraph @

go/svc/cliupdate/v1/cliupdatev1connect/service.connect.go

raw symbols SCIP
1 // Code generated by protoc-gen-connect-go. DO NOT EDIT.
2 //
3 // Source: svc/cliupdate/v1/service.proto
4
5 package cliupdatev1connect
6
7 import (
8 connect "connectrpc.com/connect"
9 context "context"
10 errors "errors"
11 v1 "github.com/humanlogio/api/go/svc/cliupdate/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 // UpdateServiceName is the fully-qualified name of the UpdateService service.
25 UpdateServiceName = "svc.cliupdate.v1.UpdateService"
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 // UpdateServiceGetNextUpdateProcedure is the fully-qualified name of the UpdateService's
37 // GetNextUpdate RPC.
38 UpdateServiceGetNextUpdateProcedure = "/svc.cliupdate.v1.UpdateService/GetNextUpdate"
39 )
40
41 // UpdateServiceClient is a client for the svc.cliupdate.v1.UpdateService service.
42 type UpdateServiceClient interface {
43 GetNextUpdate(context.Context, *connect.Request[v1.GetNextUpdateRequest]) (*connect.Response[v1.GetNextUpdateResponse], error)
44 }
45
46 // NewUpdateServiceClient constructs a client for the svc.cliupdate.v1.UpdateService service. By
47 // default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
48 // and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
49 // connect.WithGRPC() or connect.WithGRPCWeb() options.
50 //
51 // The URL supplied here should be the base URL for the Connect or gRPC server (for example,
52 // http://api.acme.com or https://acme.com/grpc).
53 func NewUpdateServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) UpdateServiceClient {
54 baseURL = strings.TrimRight(baseURL, "/")
55 updateServiceMethods := v1.File_svc_cliupdate_v1_service_proto.Services().ByName("UpdateService").Methods()
56 return &updateServiceClient{
57 getNextUpdate: connect.NewClient[v1.GetNextUpdateRequest, v1.GetNextUpdateResponse](
58 httpClient,
59 baseURL+UpdateServiceGetNextUpdateProcedure,
60 connect.WithSchema(updateServiceMethods.ByName("GetNextUpdate")),
61 connect.WithClientOptions(opts...),
62 ),
63 }
64 }
65
66 // updateServiceClient implements UpdateServiceClient.
67 type updateServiceClient struct {
68 getNextUpdate *connect.Client[v1.GetNextUpdateRequest, v1.GetNextUpdateResponse]
69 }
70
71 // GetNextUpdate calls svc.cliupdate.v1.UpdateService.GetNextUpdate.
72 func (c *updateServiceClient) GetNextUpdate(ctx context.Context, req *connect.Request[v1.GetNextUpdateRequest]) (*connect.Response[v1.GetNextUpdateResponse], error) {
73 return c.getNextUpdate.CallUnary(ctx, req)
74 }
75
76 // UpdateServiceHandler is an implementation of the svc.cliupdate.v1.UpdateService service.
77 type UpdateServiceHandler interface {
78 GetNextUpdate(context.Context, *connect.Request[v1.GetNextUpdateRequest]) (*connect.Response[v1.GetNextUpdateResponse], error)
79 }
80
81 // NewUpdateServiceHandler builds an HTTP handler from the service implementation. It returns the
82 // path on which to mount the handler and the handler itself.
83 //
84 // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
85 // and JSON codecs. They also support gzip compression.
86 func NewUpdateServiceHandler(svc UpdateServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
87 updateServiceMethods := v1.File_svc_cliupdate_v1_service_proto.Services().ByName("UpdateService").Methods()
88 updateServiceGetNextUpdateHandler := connect.NewUnaryHandler(
89 UpdateServiceGetNextUpdateProcedure,
90 svc.GetNextUpdate,
91 connect.WithSchema(updateServiceMethods.ByName("GetNextUpdate")),
92 connect.WithHandlerOptions(opts...),
93 )
94 return "/svc.cliupdate.v1.UpdateService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
95 switch r.URL.Path {
96 case UpdateServiceGetNextUpdateProcedure:
97 updateServiceGetNextUpdateHandler.ServeHTTP(w, r)
98 default:
99 http.NotFound(w, r)
100 }
101 })
102 }
103
104 // UnimplementedUpdateServiceHandler returns CodeUnimplemented from all methods.
105 type UnimplementedUpdateServiceHandler struct{}
106
107 func (UnimplementedUpdateServiceHandler) GetNextUpdate(context.Context, *connect.Request[v1.GetNextUpdateRequest]) (*connect.Response[v1.GetNextUpdateResponse], error) {
108 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.cliupdate.v1.UpdateService.GetNextUpdate is not implemented"))
109 }