瀏覽代碼

rpc调用例子

zrufo 4 年之前
父節點
當前提交
b772795027

+ 2 - 2
api/grpc/base/base.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.25.0
-// 	protoc        v3.14.0
+// 	protoc-gen-go v1.23.0
+// 	protoc        v3.11.3
 // source: base.proto
 
 package base

+ 2 - 6
api/grpc/base/base_grpc.pb.go

@@ -11,7 +11,6 @@ import (
 
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.32.0 or later.
 const _ = grpc.SupportPackageIsVersion7
 
 // ApiClient is the client API for Api service.
@@ -91,7 +90,7 @@ type UnsafeApiServer interface {
 }
 
 func RegisterApiServer(s grpc.ServiceRegistrar, srv ApiServer) {
-	s.RegisterService(&Api_ServiceDesc, srv)
+	s.RegisterService(&_Api_serviceDesc, srv)
 }
 
 func _Api_SignUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@@ -148,10 +147,7 @@ func _Api_SignOut_Handler(srv interface{}, ctx context.Context, dec func(interfa
 	return interceptor(ctx, in, info, handler)
 }
 
-// Api_ServiceDesc is the grpc.ServiceDesc for Api service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var Api_ServiceDesc = grpc.ServiceDesc{
+var _Api_serviceDesc = grpc.ServiceDesc{
 	ServiceName: "base.Api",
 	HandlerType: (*ApiServer)(nil),
 	Methods: []grpc.MethodDesc{

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module sportfitness/base
 go 1.16
 
 require (
-	git.beswell.com/gframe/application v0.3.6
+	git.beswell.com/gframe/application v0.3.9
 	github.com/ZR233/glog/v2 v2.0.1
 	github.com/armon/go-metrics v0.3.6 // indirect
 	github.com/fatih/color v1.10.0 // indirect

+ 5 - 0
main.go

@@ -21,6 +21,11 @@ func main() {
 		panic(err)
 	}
 
+	err = app.AddServiceGrpcClient("bsw/im")
+	if err != nil {
+		panic(err)
+	}
+
 	//基础库初始化
 	base.Init()
 

+ 34 - 0
repository/grpc/bsw/im/api.go

@@ -0,0 +1,34 @@
+package im
+
+import (
+	"context"
+	"git.beswell.com/gframe/application"
+	pb "sportfitness/base/repository/grpc/bsw/im/im"
+)
+
+func getClient() pb.ApiClient {
+	conn, err := application.GetServiceGrpcConn("bsw/im")
+	if err != nil {
+		panic(err)
+	}
+	return pb.NewApiClient(conn)
+}
+
+func SignUp() {
+	_, err := getClient().SignUpUserCode(context.Background(), &pb.SignUpRequest{
+		UserCode: "",
+		Name:     "",
+		Email:    "",
+		Phone:    "",
+		WxOpenId: "",
+		Qq:       "",
+		Password: "",
+		Question: "",
+		Answer:   "",
+		Memo:     "",
+	})
+
+	if err != nil {
+		panic(err)
+	}
+}

+ 20 - 0
repository/grpc/bsw/im/api_test.go

@@ -0,0 +1,20 @@
+package im
+
+import (
+	"git.beswell.com/gframe/application"
+	"github.com/sirupsen/logrus"
+	"testing"
+)
+
+func init() {
+	logrus.Info("test init")
+	app := application.NewDefault()
+	err := app.AddServiceGrpcClient("bsw/im")
+	if err != nil {
+		panic(err)
+	}
+}
+
+func TestSignUp(t *testing.T) {
+	SignUp()
+}

+ 40 - 34
repository/grpc/bsw/im/im/im.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.25.0
-// 	protoc        v3.14.0
+// 	protoc-gen-go v1.23.0
+// 	protoc        v3.11.3
 // source: im.proto
 
 package im
@@ -199,17 +199,17 @@ func (*DefaultReply) Descriptor() ([]byte, []int) {
 	return file_im_proto_rawDescGZIP(), []int{1}
 }
 
-type SignInUserCodeRequest struct {
+type SignInPasswordRequest struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Name     string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+	Auth     string `protobuf:"bytes,1,opt,name=auth,proto3" json:"auth,omitempty"`
 	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
 }
 
-func (x *SignInUserCodeRequest) Reset() {
-	*x = SignInUserCodeRequest{}
+func (x *SignInPasswordRequest) Reset() {
+	*x = SignInPasswordRequest{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_im_proto_msgTypes[2]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -217,13 +217,13 @@ func (x *SignInUserCodeRequest) Reset() {
 	}
 }
 
-func (x *SignInUserCodeRequest) String() string {
+func (x *SignInPasswordRequest) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*SignInUserCodeRequest) ProtoMessage() {}
+func (*SignInPasswordRequest) ProtoMessage() {}
 
-func (x *SignInUserCodeRequest) ProtoReflect() protoreflect.Message {
+func (x *SignInPasswordRequest) ProtoReflect() protoreflect.Message {
 	mi := &file_im_proto_msgTypes[2]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -235,19 +235,19 @@ func (x *SignInUserCodeRequest) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use SignInUserCodeRequest.ProtoReflect.Descriptor instead.
-func (*SignInUserCodeRequest) Descriptor() ([]byte, []int) {
+// Deprecated: Use SignInPasswordRequest.ProtoReflect.Descriptor instead.
+func (*SignInPasswordRequest) Descriptor() ([]byte, []int) {
 	return file_im_proto_rawDescGZIP(), []int{2}
 }
 
-func (x *SignInUserCodeRequest) GetName() string {
+func (x *SignInPasswordRequest) GetAuth() string {
 	if x != nil {
-		return x.Name
+		return x.Auth
 	}
 	return ""
 }
 
-func (x *SignInUserCodeRequest) GetPassword() string {
+func (x *SignInPasswordRequest) GetPassword() string {
 	if x != nil {
 		return x.Password
 	}
@@ -426,9 +426,9 @@ var file_im_proto_rawDesc = []byte{
 	0x0a, 0x08, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x69, 0x6d, 0x22, 0x10,
 	0x0a, 0x0e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
 	0x22, 0x0e, 0x0a, 0x0c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79,
-	0x22, 0x47, 0x0a, 0x15, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f,
-	0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
-	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a,
+	0x22, 0x47, 0x0a, 0x15, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
+	0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x75, 0x74,
+	0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x1a, 0x0a,
 	0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x23, 0x0a, 0x0b, 0x53, 0x69, 0x67,
 	0x6e, 0x49, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65,
@@ -454,7 +454,7 @@ var file_im_proto_rawDesc = []byte{
 	0x05, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xa2, 0x1f, 0x2a, 0x25, 0x0a, 0x06, 0x53, 0x74, 0x61,
 	0x74, 0x75, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x42, 0x61, 0x6e, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02,
 	0x4f, 0x6e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x09,
-	0x32, 0xe7, 0x01, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x37, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e,
+	0x32, 0xb0, 0x02, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x37, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e,
 	0x55, 0x70, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x11, 0x2e, 0x69, 0x6d, 0x2e,
 	0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e,
 	0x69, 0x6d, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22,
@@ -463,13 +463,17 @@ var file_im_proto_rawDesc = []byte{
 	0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x69, 0x6d, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
 	0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x49,
 	0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x2e, 0x69, 0x6d, 0x2e, 0x53,
-	0x69, 0x67, 0x6e, 0x49, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71,
+	0x69, 0x67, 0x6e, 0x49, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71,
 	0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x69, 0x6d, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e,
-	0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f,
-	0x75, 0x74, 0x12, 0x12, 0x2e, 0x69, 0x6d, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52,
-	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x69, 0x6d, 0x2e, 0x44, 0x65, 0x66, 0x61,
-	0x75, 0x6c, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x33,
+	0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x17, 0x53, 0x69, 0x67, 0x6e, 0x49,
+	0x6e, 0x57, 0x69, 0x74, 0x68, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
+	0x72, 0x64, 0x12, 0x19, 0x2e, 0x69, 0x6d, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x50, 0x61,
+	0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e,
+	0x69, 0x6d, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00,
+	0x12, 0x31, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x12, 0x12, 0x2e, 0x69, 0x6d,
+	0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+	0x10, 0x2e, 0x69, 0x6d, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x70, 0x6c,
+	0x79, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -491,21 +495,23 @@ var file_im_proto_goTypes = []interface{}{
 	(Status)(0),                   // 1: im.Status
 	(*DefaultRequest)(nil),        // 2: im.DefaultRequest
 	(*DefaultReply)(nil),          // 3: im.DefaultReply
-	(*SignInUserCodeRequest)(nil), // 4: im.SignInUserCodeRequest
+	(*SignInPasswordRequest)(nil), // 4: im.SignInPasswordRequest
 	(*SignInReply)(nil),           // 5: im.SignInReply
 	(*SignUpRequest)(nil),         // 6: im.SignUpRequest
 }
 var file_im_proto_depIdxs = []int32{
 	6, // 0: im.Api.SignUpUserCode:input_type -> im.SignUpRequest
 	6, // 1: im.Api.SignUpPhone:input_type -> im.SignUpRequest
-	4, // 2: im.Api.SignInUserCode:input_type -> im.SignInUserCodeRequest
-	2, // 3: im.Api.SignOut:input_type -> im.DefaultRequest
-	3, // 4: im.Api.SignUpUserCode:output_type -> im.DefaultReply
-	3, // 5: im.Api.SignUpPhone:output_type -> im.DefaultReply
-	5, // 6: im.Api.SignInUserCode:output_type -> im.SignInReply
-	3, // 7: im.Api.SignOut:output_type -> im.DefaultReply
-	4, // [4:8] is the sub-list for method output_type
-	0, // [0:4] is the sub-list for method input_type
+	4, // 2: im.Api.SignInUserCode:input_type -> im.SignInPasswordRequest
+	4, // 3: im.Api.SignInWithPhonePassword:input_type -> im.SignInPasswordRequest
+	2, // 4: im.Api.SignOut:input_type -> im.DefaultRequest
+	3, // 5: im.Api.SignUpUserCode:output_type -> im.DefaultReply
+	3, // 6: im.Api.SignUpPhone:output_type -> im.DefaultReply
+	5, // 7: im.Api.SignInUserCode:output_type -> im.SignInReply
+	5, // 8: im.Api.SignInWithPhonePassword:output_type -> im.SignInReply
+	3, // 9: im.Api.SignOut:output_type -> im.DefaultReply
+	5, // [5:10] is the sub-list for method output_type
+	0, // [0:5] is the sub-list for method input_type
 	0, // [0:0] is the sub-list for extension type_name
 	0, // [0:0] is the sub-list for extension extendee
 	0, // [0:0] is the sub-list for field type_name
@@ -542,7 +548,7 @@ func file_im_proto_init() {
 			}
 		}
 		file_im_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*SignInUserCodeRequest); i {
+			switch v := v.(*SignInPasswordRequest); i {
 			case 0:
 				return &v.state
 			case 1:

+ 44 - 12
repository/grpc/bsw/im/im/im_grpc.pb.go

@@ -11,7 +11,6 @@ import (
 
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.32.0 or later.
 const _ = grpc.SupportPackageIsVersion7
 
 // ApiClient is the client API for Api service.
@@ -20,7 +19,8 @@ const _ = grpc.SupportPackageIsVersion7
 type ApiClient interface {
 	SignUpUserCode(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*DefaultReply, error)
 	SignUpPhone(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*DefaultReply, error)
-	SignInUserCode(ctx context.Context, in *SignInUserCodeRequest, opts ...grpc.CallOption) (*SignInReply, error)
+	SignInUserCode(ctx context.Context, in *SignInPasswordRequest, opts ...grpc.CallOption) (*SignInReply, error)
+	SignInWithPhonePassword(ctx context.Context, in *SignInPasswordRequest, opts ...grpc.CallOption) (*SignInReply, error)
 	SignOut(ctx context.Context, in *DefaultRequest, opts ...grpc.CallOption) (*DefaultReply, error)
 }
 
@@ -50,7 +50,7 @@ func (c *apiClient) SignUpPhone(ctx context.Context, in *SignUpRequest, opts ...
 	return out, nil
 }
 
-func (c *apiClient) SignInUserCode(ctx context.Context, in *SignInUserCodeRequest, opts ...grpc.CallOption) (*SignInReply, error) {
+func (c *apiClient) SignInUserCode(ctx context.Context, in *SignInPasswordRequest, opts ...grpc.CallOption) (*SignInReply, error) {
 	out := new(SignInReply)
 	err := c.cc.Invoke(ctx, "/im.Api/SignInUserCode", in, out, opts...)
 	if err != nil {
@@ -59,6 +59,15 @@ func (c *apiClient) SignInUserCode(ctx context.Context, in *SignInUserCodeReques
 	return out, nil
 }
 
+func (c *apiClient) SignInWithPhonePassword(ctx context.Context, in *SignInPasswordRequest, opts ...grpc.CallOption) (*SignInReply, error) {
+	out := new(SignInReply)
+	err := c.cc.Invoke(ctx, "/im.Api/SignInWithPhonePassword", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *apiClient) SignOut(ctx context.Context, in *DefaultRequest, opts ...grpc.CallOption) (*DefaultReply, error) {
 	out := new(DefaultReply)
 	err := c.cc.Invoke(ctx, "/im.Api/SignOut", in, out, opts...)
@@ -74,7 +83,8 @@ func (c *apiClient) SignOut(ctx context.Context, in *DefaultRequest, opts ...grp
 type ApiServer interface {
 	SignUpUserCode(context.Context, *SignUpRequest) (*DefaultReply, error)
 	SignUpPhone(context.Context, *SignUpRequest) (*DefaultReply, error)
-	SignInUserCode(context.Context, *SignInUserCodeRequest) (*SignInReply, error)
+	SignInUserCode(context.Context, *SignInPasswordRequest) (*SignInReply, error)
+	SignInWithPhonePassword(context.Context, *SignInPasswordRequest) (*SignInReply, error)
 	SignOut(context.Context, *DefaultRequest) (*DefaultReply, error)
 	mustEmbedUnimplementedApiServer()
 }
@@ -89,9 +99,12 @@ func (UnimplementedApiServer) SignUpUserCode(context.Context, *SignUpRequest) (*
 func (UnimplementedApiServer) SignUpPhone(context.Context, *SignUpRequest) (*DefaultReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method SignUpPhone not implemented")
 }
-func (UnimplementedApiServer) SignInUserCode(context.Context, *SignInUserCodeRequest) (*SignInReply, error) {
+func (UnimplementedApiServer) SignInUserCode(context.Context, *SignInPasswordRequest) (*SignInReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method SignInUserCode not implemented")
 }
+func (UnimplementedApiServer) SignInWithPhonePassword(context.Context, *SignInPasswordRequest) (*SignInReply, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method SignInWithPhonePassword not implemented")
+}
 func (UnimplementedApiServer) SignOut(context.Context, *DefaultRequest) (*DefaultReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method SignOut not implemented")
 }
@@ -105,7 +118,7 @@ type UnsafeApiServer interface {
 }
 
 func RegisterApiServer(s grpc.ServiceRegistrar, srv ApiServer) {
-	s.RegisterService(&Api_ServiceDesc, srv)
+	s.RegisterService(&_Api_serviceDesc, srv)
 }
 
 func _Api_SignUpUserCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@@ -145,7 +158,7 @@ func _Api_SignUpPhone_Handler(srv interface{}, ctx context.Context, dec func(int
 }
 
 func _Api_SignInUserCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(SignInUserCodeRequest)
+	in := new(SignInPasswordRequest)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
@@ -157,7 +170,25 @@ func _Api_SignInUserCode_Handler(srv interface{}, ctx context.Context, dec func(
 		FullMethod: "/im.Api/SignInUserCode",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ApiServer).SignInUserCode(ctx, req.(*SignInUserCodeRequest))
+		return srv.(ApiServer).SignInUserCode(ctx, req.(*SignInPasswordRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _Api_SignInWithPhonePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(SignInPasswordRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ApiServer).SignInWithPhonePassword(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/im.Api/SignInWithPhonePassword",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ApiServer).SignInWithPhonePassword(ctx, req.(*SignInPasswordRequest))
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -180,10 +211,7 @@ func _Api_SignOut_Handler(srv interface{}, ctx context.Context, dec func(interfa
 	return interceptor(ctx, in, info, handler)
 }
 
-// Api_ServiceDesc is the grpc.ServiceDesc for Api service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var Api_ServiceDesc = grpc.ServiceDesc{
+var _Api_serviceDesc = grpc.ServiceDesc{
 	ServiceName: "im.Api",
 	HandlerType: (*ApiServer)(nil),
 	Methods: []grpc.MethodDesc{
@@ -199,6 +227,10 @@ var Api_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "SignInUserCode",
 			Handler:    _Api_SignInUserCode_Handler,
 		},
+		{
+			MethodName: "SignInWithPhonePassword",
+			Handler:    _Api_SignInWithPhonePassword_Handler,
+		},
 		{
 			MethodName: "SignOut",
 			Handler:    _Api_SignOut_Handler,