自动生成 protobuf 代码 (tag: v1.7.0)
This commit is contained in:
@@ -33,9 +33,6 @@ const (
|
||||
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
||||
// period.
|
||||
const (
|
||||
// UserServiceSendCredentialProcedure is the fully-qualified name of the UserService's
|
||||
// SendCredential RPC.
|
||||
UserServiceSendCredentialProcedure = "/user.v1.UserService/SendCredential"
|
||||
// UserServiceAuthProcedure is the fully-qualified name of the UserService's Auth RPC.
|
||||
UserServiceAuthProcedure = "/user.v1.UserService/Auth"
|
||||
// UserServiceSetPasswordProcedure is the fully-qualified name of the UserService's SetPassword RPC.
|
||||
@@ -56,7 +53,6 @@ const (
|
||||
|
||||
// UserServiceClient is a client for the user.v1.UserService service.
|
||||
type UserServiceClient interface {
|
||||
SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error)
|
||||
Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error)
|
||||
SetPassword(context.Context, *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error)
|
||||
SetName(context.Context, *connect.Request[v1.SetNameRequest]) (*connect.Response[v1.SetNameResponse], error)
|
||||
@@ -77,12 +73,6 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
userServiceMethods := v1.File_user_v1_service_proto.Services().ByName("UserService").Methods()
|
||||
return &userServiceClient{
|
||||
sendCredential: connect.NewClient[v1.SendCredentialRequest, v1.SendCredentialResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceSendCredentialProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("SendCredential")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
auth: connect.NewClient[v1.AuthRequest, v1.AuthResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceAuthProcedure,
|
||||
@@ -130,7 +120,6 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
|
||||
|
||||
// userServiceClient implements UserServiceClient.
|
||||
type userServiceClient struct {
|
||||
sendCredential *connect.Client[v1.SendCredentialRequest, v1.SendCredentialResponse]
|
||||
auth *connect.Client[v1.AuthRequest, v1.AuthResponse]
|
||||
setPassword *connect.Client[v1.SetPasswordRequest, v1.SetPasswordResponse]
|
||||
setName *connect.Client[v1.SetNameRequest, v1.SetNameResponse]
|
||||
@@ -140,11 +129,6 @@ type userServiceClient struct {
|
||||
getUserInfo *connect.Client[v1.GetUserInfoRequest, v1.GetUserInfoResponse]
|
||||
}
|
||||
|
||||
// SendCredential calls user.v1.UserService.SendCredential.
|
||||
func (c *userServiceClient) SendCredential(ctx context.Context, req *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) {
|
||||
return c.sendCredential.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// Auth calls user.v1.UserService.Auth.
|
||||
func (c *userServiceClient) Auth(ctx context.Context, req *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) {
|
||||
return c.auth.CallUnary(ctx, req)
|
||||
@@ -182,7 +166,6 @@ func (c *userServiceClient) GetUserInfo(ctx context.Context, req *connect.Reques
|
||||
|
||||
// UserServiceHandler is an implementation of the user.v1.UserService service.
|
||||
type UserServiceHandler interface {
|
||||
SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error)
|
||||
Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error)
|
||||
SetPassword(context.Context, *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error)
|
||||
SetName(context.Context, *connect.Request[v1.SetNameRequest]) (*connect.Response[v1.SetNameResponse], error)
|
||||
@@ -199,12 +182,6 @@ type UserServiceHandler interface {
|
||||
// and JSON codecs. They also support gzip compression.
|
||||
func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
userServiceMethods := v1.File_user_v1_service_proto.Services().ByName("UserService").Methods()
|
||||
userServiceSendCredentialHandler := connect.NewUnaryHandler(
|
||||
UserServiceSendCredentialProcedure,
|
||||
svc.SendCredential,
|
||||
connect.WithSchema(userServiceMethods.ByName("SendCredential")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
userServiceAuthHandler := connect.NewUnaryHandler(
|
||||
UserServiceAuthProcedure,
|
||||
svc.Auth,
|
||||
@@ -249,8 +226,6 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
|
||||
)
|
||||
return "/user.v1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case UserServiceSendCredentialProcedure:
|
||||
userServiceSendCredentialHandler.ServeHTTP(w, r)
|
||||
case UserServiceAuthProcedure:
|
||||
userServiceAuthHandler.ServeHTTP(w, r)
|
||||
case UserServiceSetPasswordProcedure:
|
||||
@@ -274,10 +249,6 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
|
||||
// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedUserServiceHandler struct{}
|
||||
|
||||
func (UnimplementedUserServiceHandler) SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.SendCredential is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedUserServiceHandler) Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.Auth is not implemented"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user