自动生成 protobuf 代码 (tag: v1.12.0)
This commit is contained in:
@@ -47,6 +47,9 @@ const (
|
||||
UserServiceSetDescriptionProcedure = "/corestack.user.v1.UserService/SetDescription"
|
||||
// UserServiceGetUserInfoProcedure is the fully-qualified name of the UserService's GetUserInfo RPC.
|
||||
UserServiceGetUserInfoProcedure = "/corestack.user.v1.UserService/GetUserInfo"
|
||||
// UserServiceBindWxOpenIDProcedure is the fully-qualified name of the UserService's BindWxOpenID
|
||||
// RPC.
|
||||
UserServiceBindWxOpenIDProcedure = "/corestack.user.v1.UserService/BindWxOpenID"
|
||||
)
|
||||
|
||||
// UserServiceClient is a client for the corestack.user.v1.UserService service.
|
||||
@@ -57,6 +60,7 @@ type UserServiceClient interface {
|
||||
SetAvatar(context.Context, *connect.Request[v1.SetAvatarRequest]) (*connect.Response[v1.SetAvatarResponse], error)
|
||||
SetDescription(context.Context, *connect.Request[v1.SetDescriptionRequest]) (*connect.Response[v1.SetDescriptionResponse], error)
|
||||
GetUserInfo(context.Context, *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error)
|
||||
BindWxOpenID(context.Context, *connect.Request[v1.BindWxOpenIDRequest]) (*connect.Response[v1.BindWxOpenIDResponse], error)
|
||||
}
|
||||
|
||||
// NewUserServiceClient constructs a client for the corestack.user.v1.UserService service. By
|
||||
@@ -106,6 +110,12 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
|
||||
connect.WithSchema(userServiceMethods.ByName("GetUserInfo")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
bindWxOpenID: connect.NewClient[v1.BindWxOpenIDRequest, v1.BindWxOpenIDResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceBindWxOpenIDProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("BindWxOpenID")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +127,7 @@ type userServiceClient struct {
|
||||
setAvatar *connect.Client[v1.SetAvatarRequest, v1.SetAvatarResponse]
|
||||
setDescription *connect.Client[v1.SetDescriptionRequest, v1.SetDescriptionResponse]
|
||||
getUserInfo *connect.Client[v1.GetUserInfoRequest, v1.GetUserInfoResponse]
|
||||
bindWxOpenID *connect.Client[v1.BindWxOpenIDRequest, v1.BindWxOpenIDResponse]
|
||||
}
|
||||
|
||||
// SetPassword calls corestack.user.v1.UserService.SetPassword.
|
||||
@@ -149,6 +160,11 @@ func (c *userServiceClient) GetUserInfo(ctx context.Context, req *connect.Reques
|
||||
return c.getUserInfo.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// BindWxOpenID calls corestack.user.v1.UserService.BindWxOpenID.
|
||||
func (c *userServiceClient) BindWxOpenID(ctx context.Context, req *connect.Request[v1.BindWxOpenIDRequest]) (*connect.Response[v1.BindWxOpenIDResponse], error) {
|
||||
return c.bindWxOpenID.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// UserServiceHandler is an implementation of the corestack.user.v1.UserService service.
|
||||
type UserServiceHandler interface {
|
||||
SetPassword(context.Context, *connect.Request[v1.SetPasswordRequest]) (*connect.Response[v1.SetPasswordResponse], error)
|
||||
@@ -157,6 +173,7 @@ type UserServiceHandler interface {
|
||||
SetAvatar(context.Context, *connect.Request[v1.SetAvatarRequest]) (*connect.Response[v1.SetAvatarResponse], error)
|
||||
SetDescription(context.Context, *connect.Request[v1.SetDescriptionRequest]) (*connect.Response[v1.SetDescriptionResponse], error)
|
||||
GetUserInfo(context.Context, *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error)
|
||||
BindWxOpenID(context.Context, *connect.Request[v1.BindWxOpenIDRequest]) (*connect.Response[v1.BindWxOpenIDResponse], error)
|
||||
}
|
||||
|
||||
// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path
|
||||
@@ -202,6 +219,12 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
|
||||
connect.WithSchema(userServiceMethods.ByName("GetUserInfo")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
userServiceBindWxOpenIDHandler := connect.NewUnaryHandler(
|
||||
UserServiceBindWxOpenIDProcedure,
|
||||
svc.BindWxOpenID,
|
||||
connect.WithSchema(userServiceMethods.ByName("BindWxOpenID")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/corestack.user.v1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case UserServiceSetPasswordProcedure:
|
||||
@@ -216,6 +239,8 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
|
||||
userServiceSetDescriptionHandler.ServeHTTP(w, r)
|
||||
case UserServiceGetUserInfoProcedure:
|
||||
userServiceGetUserInfoHandler.ServeHTTP(w, r)
|
||||
case UserServiceBindWxOpenIDProcedure:
|
||||
userServiceBindWxOpenIDHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
@@ -248,3 +273,7 @@ func (UnimplementedUserServiceHandler) SetDescription(context.Context, *connect.
|
||||
func (UnimplementedUserServiceHandler) GetUserInfo(context.Context, *connect.Request[v1.GetUserInfoRequest]) (*connect.Response[v1.GetUserInfoResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("corestack.user.v1.UserService.GetUserInfo is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedUserServiceHandler) BindWxOpenID(context.Context, *connect.Request[v1.BindWxOpenIDRequest]) (*connect.Response[v1.BindWxOpenIDResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("corestack.user.v1.UserService.BindWxOpenID is not implemented"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user