| 1 |
|
| 2 |
|
| 3 |
|
| 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 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
const _ = connect.IsAtLeastVersion1_13_0 |
| 22 |
|
| 23 |
const ( |
| 24 |
|
| 25 |
UpdateServiceName = "svc.cliupdate.v1.UpdateService" |
| 26 |
) |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
const ( |
| 36 |
|
| 37 |
|
| 38 |
UpdateServiceGetNextUpdateProcedure = "/svc.cliupdate.v1.UpdateService/GetNextUpdate" |
| 39 |
) |
| 40 |
|
| 41 |
|
| 42 |
type UpdateServiceClient interface { |
| 43 |
GetNextUpdate(context.Context, *connect.Request[v1.GetNextUpdateRequest]) (*connect.Response[v1.GetNextUpdateResponse], error) |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 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 |
|
| 67 |
type updateServiceClient struct { |
| 68 |
getNextUpdate *connect.Client[v1.GetNextUpdateRequest, v1.GetNextUpdateResponse] |
| 69 |
} |
| 70 |
|
| 71 |
|
| 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 |
|
| 77 |
type UpdateServiceHandler interface { |
| 78 |
GetNextUpdate(context.Context, *connect.Request[v1.GetNextUpdateRequest]) (*connect.Response[v1.GetNextUpdateResponse], error) |
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 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 |
|
| 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 |
} |