Debian Codegraph @

go/svc/account/v1/accountv1connect/service.connect.go

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