Debian Codegraph @

go/svc/ingest/v1/ingestv1connect/service.connect.go

raw symbols SCIP
1 // Code generated by protoc-gen-connect-go. DO NOT EDIT.
2 //
3 // Source: svc/ingest/v1/service.proto
4
5 package ingestv1connect
6
7 import (
8 connect "connectrpc.com/connect"
9 context "context"
10 errors "errors"
11 v1 "github.com/humanlogio/api/go/svc/ingest/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 // IngestServiceName is the fully-qualified name of the IngestService service.
25 IngestServiceName = "svc.ingest.v1.IngestService"
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 // IngestServiceGetHeartbeatProcedure is the fully-qualified name of the IngestService's
37 // GetHeartbeat RPC.
38 IngestServiceGetHeartbeatProcedure = "/svc.ingest.v1.IngestService/GetHeartbeat"
39 // IngestServiceIngestProcedure is the fully-qualified name of the IngestService's Ingest RPC.
40 IngestServiceIngestProcedure = "/svc.ingest.v1.IngestService/Ingest"
41 // IngestServiceIngestStreamProcedure is the fully-qualified name of the IngestService's
42 // IngestStream RPC.
43 IngestServiceIngestStreamProcedure = "/svc.ingest.v1.IngestService/IngestStream"
44 // IngestServiceIngestBidiStreamProcedure is the fully-qualified name of the IngestService's
45 // IngestBidiStream RPC.
46 IngestServiceIngestBidiStreamProcedure = "/svc.ingest.v1.IngestService/IngestBidiStream"
47 )
48
49 // IngestServiceClient is a client for the svc.ingest.v1.IngestService service.
50 type IngestServiceClient interface {
51 GetHeartbeat(context.Context, *connect.Request[v1.GetHeartbeatRequest]) (*connect.Response[v1.GetHeartbeatResponse], error)
52 Ingest(context.Context, *connect.Request[v1.IngestRequest]) (*connect.Response[v1.IngestResponse], error)
53 IngestStream(context.Context) *connect.ClientStreamForClient[v1.IngestStreamRequest, v1.IngestStreamResponse]
54 IngestBidiStream(context.Context) *connect.BidiStreamForClient[v1.IngestBidiStreamRequest, v1.IngestBidiStreamResponse]
55 }
56
57 // NewIngestServiceClient constructs a client for the svc.ingest.v1.IngestService service. By
58 // default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
59 // and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
60 // connect.WithGRPC() or connect.WithGRPCWeb() options.
61 //
62 // The URL supplied here should be the base URL for the Connect or gRPC server (for example,
63 // http://api.acme.com or https://acme.com/grpc).
64 func NewIngestServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) IngestServiceClient {
65 baseURL = strings.TrimRight(baseURL, "/")
66 ingestServiceMethods := v1.File_svc_ingest_v1_service_proto.Services().ByName("IngestService").Methods()
67 return &ingestServiceClient{
68 getHeartbeat: connect.NewClient[v1.GetHeartbeatRequest, v1.GetHeartbeatResponse](
69 httpClient,
70 baseURL+IngestServiceGetHeartbeatProcedure,
71 connect.WithSchema(ingestServiceMethods.ByName("GetHeartbeat")),
72 connect.WithClientOptions(opts...),
73 ),
74 ingest: connect.NewClient[v1.IngestRequest, v1.IngestResponse](
75 httpClient,
76 baseURL+IngestServiceIngestProcedure,
77 connect.WithSchema(ingestServiceMethods.ByName("Ingest")),
78 connect.WithClientOptions(opts...),
79 ),
80 ingestStream: connect.NewClient[v1.IngestStreamRequest, v1.IngestStreamResponse](
81 httpClient,
82 baseURL+IngestServiceIngestStreamProcedure,
83 connect.WithSchema(ingestServiceMethods.ByName("IngestStream")),
84 connect.WithClientOptions(opts...),
85 ),
86 ingestBidiStream: connect.NewClient[v1.IngestBidiStreamRequest, v1.IngestBidiStreamResponse](
87 httpClient,
88 baseURL+IngestServiceIngestBidiStreamProcedure,
89 connect.WithSchema(ingestServiceMethods.ByName("IngestBidiStream")),
90 connect.WithClientOptions(opts...),
91 ),
92 }
93 }
94
95 // ingestServiceClient implements IngestServiceClient.
96 type ingestServiceClient struct {
97 getHeartbeat *connect.Client[v1.GetHeartbeatRequest, v1.GetHeartbeatResponse]
98 ingest *connect.Client[v1.IngestRequest, v1.IngestResponse]
99 ingestStream *connect.Client[v1.IngestStreamRequest, v1.IngestStreamResponse]
100 ingestBidiStream *connect.Client[v1.IngestBidiStreamRequest, v1.IngestBidiStreamResponse]
101 }
102
103 // GetHeartbeat calls svc.ingest.v1.IngestService.GetHeartbeat.
104 func (c *ingestServiceClient) GetHeartbeat(ctx context.Context, req *connect.Request[v1.GetHeartbeatRequest]) (*connect.Response[v1.GetHeartbeatResponse], error) {
105 return c.getHeartbeat.CallUnary(ctx, req)
106 }
107
108 // Ingest calls svc.ingest.v1.IngestService.Ingest.
109 func (c *ingestServiceClient) Ingest(ctx context.Context, req *connect.Request[v1.IngestRequest]) (*connect.Response[v1.IngestResponse], error) {
110 return c.ingest.CallUnary(ctx, req)
111 }
112
113 // IngestStream calls svc.ingest.v1.IngestService.IngestStream.
114 func (c *ingestServiceClient) IngestStream(ctx context.Context) *connect.ClientStreamForClient[v1.IngestStreamRequest, v1.IngestStreamResponse] {
115 return c.ingestStream.CallClientStream(ctx)
116 }
117
118 // IngestBidiStream calls svc.ingest.v1.IngestService.IngestBidiStream.
119 func (c *ingestServiceClient) IngestBidiStream(ctx context.Context) *connect.BidiStreamForClient[v1.IngestBidiStreamRequest, v1.IngestBidiStreamResponse] {
120 return c.ingestBidiStream.CallBidiStream(ctx)
121 }
122
123 // IngestServiceHandler is an implementation of the svc.ingest.v1.IngestService service.
124 type IngestServiceHandler interface {
125 GetHeartbeat(context.Context, *connect.Request[v1.GetHeartbeatRequest]) (*connect.Response[v1.GetHeartbeatResponse], error)
126 Ingest(context.Context, *connect.Request[v1.IngestRequest]) (*connect.Response[v1.IngestResponse], error)
127 IngestStream(context.Context, *connect.ClientStream[v1.IngestStreamRequest]) (*connect.Response[v1.IngestStreamResponse], error)
128 IngestBidiStream(context.Context, *connect.BidiStream[v1.IngestBidiStreamRequest, v1.IngestBidiStreamResponse]) error
129 }
130
131 // NewIngestServiceHandler builds an HTTP handler from the service implementation. It returns the
132 // path on which to mount the handler and the handler itself.
133 //
134 // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
135 // and JSON codecs. They also support gzip compression.
136 func NewIngestServiceHandler(svc IngestServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
137 ingestServiceMethods := v1.File_svc_ingest_v1_service_proto.Services().ByName("IngestService").Methods()
138 ingestServiceGetHeartbeatHandler := connect.NewUnaryHandler(
139 IngestServiceGetHeartbeatProcedure,
140 svc.GetHeartbeat,
141 connect.WithSchema(ingestServiceMethods.ByName("GetHeartbeat")),
142 connect.WithHandlerOptions(opts...),
143 )
144 ingestServiceIngestHandler := connect.NewUnaryHandler(
145 IngestServiceIngestProcedure,
146 svc.Ingest,
147 connect.WithSchema(ingestServiceMethods.ByName("Ingest")),
148 connect.WithHandlerOptions(opts...),
149 )
150 ingestServiceIngestStreamHandler := connect.NewClientStreamHandler(
151 IngestServiceIngestStreamProcedure,
152 svc.IngestStream,
153 connect.WithSchema(ingestServiceMethods.ByName("IngestStream")),
154 connect.WithHandlerOptions(opts...),
155 )
156 ingestServiceIngestBidiStreamHandler := connect.NewBidiStreamHandler(
157 IngestServiceIngestBidiStreamProcedure,
158 svc.IngestBidiStream,
159 connect.WithSchema(ingestServiceMethods.ByName("IngestBidiStream")),
160 connect.WithHandlerOptions(opts...),
161 )
162 return "/svc.ingest.v1.IngestService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
163 switch r.URL.Path {
164 case IngestServiceGetHeartbeatProcedure:
165 ingestServiceGetHeartbeatHandler.ServeHTTP(w, r)
166 case IngestServiceIngestProcedure:
167 ingestServiceIngestHandler.ServeHTTP(w, r)
168 case IngestServiceIngestStreamProcedure:
169 ingestServiceIngestStreamHandler.ServeHTTP(w, r)
170 case IngestServiceIngestBidiStreamProcedure:
171 ingestServiceIngestBidiStreamHandler.ServeHTTP(w, r)
172 default:
173 http.NotFound(w, r)
174 }
175 })
176 }
177
178 // UnimplementedIngestServiceHandler returns CodeUnimplemented from all methods.
179 type UnimplementedIngestServiceHandler struct{}
180
181 func (UnimplementedIngestServiceHandler) GetHeartbeat(context.Context, *connect.Request[v1.GetHeartbeatRequest]) (*connect.Response[v1.GetHeartbeatResponse], error) {
182 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.ingest.v1.IngestService.GetHeartbeat is not implemented"))
183 }
184
185 func (UnimplementedIngestServiceHandler) Ingest(context.Context, *connect.Request[v1.IngestRequest]) (*connect.Response[v1.IngestResponse], error) {
186 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.ingest.v1.IngestService.Ingest is not implemented"))
187 }
188
189 func (UnimplementedIngestServiceHandler) IngestStream(context.Context, *connect.ClientStream[v1.IngestStreamRequest]) (*connect.Response[v1.IngestStreamResponse], error) {
190 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.ingest.v1.IngestService.IngestStream is not implemented"))
191 }
192
193 func (UnimplementedIngestServiceHandler) IngestBidiStream(context.Context, *connect.BidiStream[v1.IngestBidiStreamRequest, v1.IngestBidiStreamResponse]) error {
194 return connect.NewError(connect.CodeUnimplemented, errors.New("svc.ingest.v1.IngestService.IngestBidiStream is not implemented"))
195 }