| 1 |
|
| 2 |
|
| 3 |
|
| 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 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
const _ = connect.IsAtLeastVersion1_13_0 |
| 22 |
|
| 23 |
const ( |
| 24 |
|
| 25 |
AccountServiceName = "svc.account.v1.AccountService" |
| 26 |
) |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
const ( |
| 36 |
|
| 37 |
|
| 38 |
AccountServiceListMachineProcedure = "/svc.account.v1.AccountService/ListMachine" |
| 39 |
) |
| 40 |
|
| 41 |
|
| 42 |
var ( |
| 43 |
accountServiceServiceDescriptor = v1.File_svc_account_v1_service_proto.Services().ByName("AccountService") |
| 44 |
accountServiceListMachineMethodDescriptor = accountServiceServiceDescriptor.Methods().ByName("ListMachine") |
| 45 |
) |
| 46 |
|
| 47 |
|
| 48 |
type AccountServiceClient interface { |
| 49 |
ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error) |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 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 |
|
| 72 |
type accountServiceClient struct { |
| 73 |
listMachine *connect.Client[v1.ListMachineRequest, v1.ListMachineResponse] |
| 74 |
} |
| 75 |
|
| 76 |
|
| 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 |
|
| 82 |
type AccountServiceHandler interface { |
| 83 |
ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error) |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 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 |
|
| 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 |
} |