diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3a7d566..a001d2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,22 @@ on: jobs: + test: + environment: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.22.0' + - name: Test + env: + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + run: make test build_and_publish: #needs: test @@ -27,4 +42,4 @@ jobs: run: echo ${{ secrets.DOCKER_REGISTRY_PWD }} | docker login registry.nccupass.com --username ${{ secrets.DOCKER_REGISTRY_USER }} --password-stdin - name: Build and push Docker image - run: make docker_push \ No newline at end of file + run: make docker_push diff --git a/migrations/2405170335_create_users_table.up.sql b/migrations/2405170335_create_users_table.up.sql index 870fc27..d1f9385 100644 --- a/migrations/2405170335_create_users_table.up.sql +++ b/migrations/2405170335_create_users_table.up.sql @@ -4,7 +4,8 @@ CREATE TABLE user_identity( created_at timestamp default CURRENT_TIMESTAMP, activated boolean default false, refresh_token varchar(100), - device_token varchar(100) + device_token varchar(100), + nick_id VARCHAR(150) UNIQUE ); CREATE TABLE email_login( diff --git a/protobuf/friend.proto b/protobuf/friend.proto new file mode 100644 index 0000000..a792152 --- /dev/null +++ b/protobuf/friend.proto @@ -0,0 +1,97 @@ +syntax = "proto3"; +option go_package = "github.com/SpeedReach/monify"; + +import "google/api/annotations.proto"; + +message FriendEmpty{} + +service FriendService{ + + rpc DeleteFriend(DeleteFriendRequest) returns (FriendEmpty){ + option (google.api.http) = { + delete: "/v1/friend/{relation_id}" + }; + } + + rpc ListFriend(FriendEmpty) returns (ListFriendResponse){ + option (google.api.http) = { + get: "/v1/friend" + }; + } + + rpc InviteFriend(InviteFriendRequest) returns (InviteFriendResponse){ + option (google.api.http) = { + post: "/v1/friend/invite" + body: "*" + }; + } + + rpc ListFriendInvitation(FriendEmpty) returns (ListFriendInvitationResponse){ + option (google.api.http) = { + get: "/v1/friend/invite" + }; + } + + // Add the record on the table(friend) + rpc AcceptInvitation_post_(AcceptInvitation_post_Request) returns (FriendEmpty){ + option (google.api.http) = { + post: "/v1/friend" + }; + } + + // Delete the record from the table(friend invite) + rpc AcceptInvitation_delete_(AcceptInvitation_delete_Request) returns (FriendEmpty){ + option (google.api.http) = { + delete: "/v1/friend/accept_invitation/{invite_id}" + }; + } + + rpc RejectInvitation(RejectInvitationRequest) returns (FriendEmpty){ + option (google.api.http) = { + delete: "/v1/friend/reject_invitation/{invite_id}" + }; + } +} + +message DeleteFriendRequest{ + string relation_id = 1; +} + +message ListFriendResponse{ + repeated Friend friends = 1; +} + +message Friend{ + string friend_id = 1; + string name = 2; +} + +message InviteFriendRequest{ + string receiver_nickId = 1; +} + +message InviteFriendResponse{ + string invite_id = 1; +} + +message ListFriendInvitationResponse{ + repeated Invitation invitation = 1; +} + +message Invitation{ + string sender_nickId = 1; + string sender_name = 2; +} + +message AcceptInvitation_post_Request{ + string user1_id = 1; + string user2_id = 2; +} + +message AcceptInvitation_delete_Request{ + string invite_id = 1; +} + +message RejectInvitationRequest{ + string invite_id = 1; +} diff --git a/protobuf/gen/go/auth.pb.go b/protobuf/gen/go/auth.pb.go index 33a4fa5..52bc80b 100644 --- a/protobuf/gen/go/auth.pb.go +++ b/protobuf/gen/go/auth.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc-gen-go v1.28.1 +// protoc v5.27.0 // source: auth.proto package monify @@ -436,26 +436,26 @@ var file_auth_proto_rawDesc = []byte{ 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, - 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x5c, 0x0a, 0x0d, + 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x5c, 0x0a, 0x0d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, - 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x5e, 0x0a, 0x0c, 0x52, 0x65, + 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x5e, 0x0a, 0x0c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, - 0x01, 0x2a, 0x22, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x66, - 0x72, 0x65, 0x73, 0x68, 0x2d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x5c, 0x92, 0x41, 0x3b, 0x12, - 0x05, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, - 0x66, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2a, 0x01, 0x02, 0x5a, 0x1f, 0x0a, 0x1d, 0x0a, 0x06, 0x42, - 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x13, 0x08, 0x02, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x70, 0x65, 0x65, 0x64, 0x52, 0x65, 0x61, 0x63, - 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, + 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, + 0x68, 0x2d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x01, 0x2a, 0x42, 0x5c, 0x5a, 0x1c, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x70, 0x65, 0x65, 0x64, 0x52, 0x65, + 0x61, 0x63, 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, 0x92, 0x41, 0x3b, 0x12, 0x05, 0x32, + 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, + 0x2e, 0x64, 0x65, 0x76, 0x2a, 0x01, 0x02, 0x5a, 0x1f, 0x0a, 0x1d, 0x0a, 0x06, 0x42, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x12, 0x13, 0x08, 0x02, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protobuf/gen/go/auth_grpc.pb.go b/protobuf/gen/go/auth_grpc.pb.go index 6291cac..d296a0a 100644 --- a/protobuf/gen/go/auth_grpc.pb.go +++ b/protobuf/gen/go/auth_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.27.0 // source: auth.proto package monify @@ -18,12 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - AuthService_EmailLogin_FullMethodName = "/AuthService/EmailLogin" - AuthService_EmailRegister_FullMethodName = "/AuthService/EmailRegister" - AuthService_RefreshToken_FullMethodName = "/AuthService/RefreshToken" -) - // AuthServiceClient is the client API for AuthService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -43,7 +37,7 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { func (c *authServiceClient) EmailLogin(ctx context.Context, in *EmailLoginRequest, opts ...grpc.CallOption) (*EmailLoginResponse, error) { out := new(EmailLoginResponse) - err := c.cc.Invoke(ctx, AuthService_EmailLogin_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/AuthService/EmailLogin", in, out, opts...) if err != nil { return nil, err } @@ -52,7 +46,7 @@ func (c *authServiceClient) EmailLogin(ctx context.Context, in *EmailLoginReques func (c *authServiceClient) EmailRegister(ctx context.Context, in *EmailRegisterRequest, opts ...grpc.CallOption) (*EmailRegisterResponse, error) { out := new(EmailRegisterResponse) - err := c.cc.Invoke(ctx, AuthService_EmailRegister_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/AuthService/EmailRegister", in, out, opts...) if err != nil { return nil, err } @@ -61,7 +55,7 @@ func (c *authServiceClient) EmailRegister(ctx context.Context, in *EmailRegister func (c *authServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error) { out := new(RefreshTokenResponse) - err := c.cc.Invoke(ctx, AuthService_RefreshToken_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/AuthService/RefreshToken", in, out, opts...) if err != nil { return nil, err } @@ -114,7 +108,7 @@ func _AuthService_EmailLogin_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: AuthService_EmailLogin_FullMethodName, + FullMethod: "/AuthService/EmailLogin", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AuthServiceServer).EmailLogin(ctx, req.(*EmailLoginRequest)) @@ -132,7 +126,7 @@ func _AuthService_EmailRegister_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: AuthService_EmailRegister_FullMethodName, + FullMethod: "/AuthService/EmailRegister", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AuthServiceServer).EmailRegister(ctx, req.(*EmailRegisterRequest)) @@ -150,7 +144,7 @@ func _AuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: AuthService_RefreshToken_FullMethodName, + FullMethod: "/AuthService/RefreshToken", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AuthServiceServer).RefreshToken(ctx, req.(*RefreshTokenRequest)) diff --git a/protobuf/gen/go/friend.pb.go b/protobuf/gen/go/friend.pb.go new file mode 100644 index 0000000..b7cc805 --- /dev/null +++ b/protobuf/gen/go/friend.pb.go @@ -0,0 +1,859 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.0 +// source: friend.proto + +package monify + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type FriendEmpty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *FriendEmpty) Reset() { + *x = FriendEmpty{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendEmpty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendEmpty) ProtoMessage() {} + +func (x *FriendEmpty) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendEmpty.ProtoReflect.Descriptor instead. +func (*FriendEmpty) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{0} +} + +type DeleteFriendRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelationId string `protobuf:"bytes,1,opt,name=relation_id,json=relationId,proto3" json:"relation_id,omitempty"` +} + +func (x *DeleteFriendRequest) Reset() { + *x = DeleteFriendRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteFriendRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteFriendRequest) ProtoMessage() {} + +func (x *DeleteFriendRequest) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteFriendRequest.ProtoReflect.Descriptor instead. +func (*DeleteFriendRequest) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{1} +} + +func (x *DeleteFriendRequest) GetRelationId() string { + if x != nil { + return x.RelationId + } + return "" +} + +type ListFriendResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Friends []*Friend `protobuf:"bytes,1,rep,name=friends,proto3" json:"friends,omitempty"` +} + +func (x *ListFriendResponse) Reset() { + *x = ListFriendResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFriendResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFriendResponse) ProtoMessage() {} + +func (x *ListFriendResponse) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFriendResponse.ProtoReflect.Descriptor instead. +func (*ListFriendResponse) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{2} +} + +func (x *ListFriendResponse) GetFriends() []*Friend { + if x != nil { + return x.Friends + } + return nil +} + +type Friend struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendId string `protobuf:"bytes,1,opt,name=friend_id,json=friendId,proto3" json:"friend_id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Friend) Reset() { + *x = Friend{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Friend) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Friend) ProtoMessage() {} + +func (x *Friend) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Friend.ProtoReflect.Descriptor instead. +func (*Friend) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{3} +} + +func (x *Friend) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + +func (x *Friend) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type InviteFriendRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ReceiverNickId string `protobuf:"bytes,1,opt,name=receiver_nickId,json=receiverNickId,proto3" json:"receiver_nickId,omitempty"` +} + +func (x *InviteFriendRequest) Reset() { + *x = InviteFriendRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InviteFriendRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InviteFriendRequest) ProtoMessage() {} + +func (x *InviteFriendRequest) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InviteFriendRequest.ProtoReflect.Descriptor instead. +func (*InviteFriendRequest) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{4} +} + +func (x *InviteFriendRequest) GetReceiverNickId() string { + if x != nil { + return x.ReceiverNickId + } + return "" +} + +type InviteFriendResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InviteId string `protobuf:"bytes,1,opt,name=invite_id,json=inviteId,proto3" json:"invite_id,omitempty"` +} + +func (x *InviteFriendResponse) Reset() { + *x = InviteFriendResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InviteFriendResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InviteFriendResponse) ProtoMessage() {} + +func (x *InviteFriendResponse) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InviteFriendResponse.ProtoReflect.Descriptor instead. +func (*InviteFriendResponse) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{5} +} + +func (x *InviteFriendResponse) GetInviteId() string { + if x != nil { + return x.InviteId + } + return "" +} + +type ListFriendInvitationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Invitation []*Invitation `protobuf:"bytes,1,rep,name=invitation,proto3" json:"invitation,omitempty"` +} + +func (x *ListFriendInvitationResponse) Reset() { + *x = ListFriendInvitationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFriendInvitationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFriendInvitationResponse) ProtoMessage() {} + +func (x *ListFriendInvitationResponse) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFriendInvitationResponse.ProtoReflect.Descriptor instead. +func (*ListFriendInvitationResponse) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{6} +} + +func (x *ListFriendInvitationResponse) GetInvitation() []*Invitation { + if x != nil { + return x.Invitation + } + return nil +} + +type Invitation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderNickId string `protobuf:"bytes,1,opt,name=sender_nickId,json=senderNickId,proto3" json:"sender_nickId,omitempty"` + SenderName string `protobuf:"bytes,2,opt,name=sender_name,json=senderName,proto3" json:"sender_name,omitempty"` +} + +func (x *Invitation) Reset() { + *x = Invitation{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Invitation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Invitation) ProtoMessage() {} + +func (x *Invitation) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Invitation.ProtoReflect.Descriptor instead. +func (*Invitation) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{7} +} + +func (x *Invitation) GetSenderNickId() string { + if x != nil { + return x.SenderNickId + } + return "" +} + +func (x *Invitation) GetSenderName() string { + if x != nil { + return x.SenderName + } + return "" +} + +type AcceptInvitationPost_Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User1Id string `protobuf:"bytes,1,opt,name=user1_id,json=user1Id,proto3" json:"user1_id,omitempty"` + User2Id string `protobuf:"bytes,2,opt,name=user2_id,json=user2Id,proto3" json:"user2_id,omitempty"` +} + +func (x *AcceptInvitationPost_Request) Reset() { + *x = AcceptInvitationPost_Request{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcceptInvitationPost_Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcceptInvitationPost_Request) ProtoMessage() {} + +func (x *AcceptInvitationPost_Request) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcceptInvitationPost_Request.ProtoReflect.Descriptor instead. +func (*AcceptInvitationPost_Request) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{8} +} + +func (x *AcceptInvitationPost_Request) GetUser1Id() string { + if x != nil { + return x.User1Id + } + return "" +} + +func (x *AcceptInvitationPost_Request) GetUser2Id() string { + if x != nil { + return x.User2Id + } + return "" +} + +type AcceptInvitationDelete_Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InviteId string `protobuf:"bytes,1,opt,name=invite_id,json=inviteId,proto3" json:"invite_id,omitempty"` +} + +func (x *AcceptInvitationDelete_Request) Reset() { + *x = AcceptInvitationDelete_Request{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcceptInvitationDelete_Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcceptInvitationDelete_Request) ProtoMessage() {} + +func (x *AcceptInvitationDelete_Request) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcceptInvitationDelete_Request.ProtoReflect.Descriptor instead. +func (*AcceptInvitationDelete_Request) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{9} +} + +func (x *AcceptInvitationDelete_Request) GetInviteId() string { + if x != nil { + return x.InviteId + } + return "" +} + +type RejectInvitationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InviteId string `protobuf:"bytes,1,opt,name=invite_id,json=inviteId,proto3" json:"invite_id,omitempty"` +} + +func (x *RejectInvitationRequest) Reset() { + *x = RejectInvitationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RejectInvitationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RejectInvitationRequest) ProtoMessage() {} + +func (x *RejectInvitationRequest) ProtoReflect() protoreflect.Message { + mi := &file_friend_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RejectInvitationRequest.ProtoReflect.Descriptor instead. +func (*RejectInvitationRequest) Descriptor() ([]byte, []int) { + return file_friend_proto_rawDescGZIP(), []int{10} +} + +func (x *RejectInvitationRequest) GetInviteId() string { + if x != nil { + return x.InviteId + } + return "" +} + +var File_friend_proto protoreflect.FileDescriptor + +var file_friend_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0d, 0x0a, 0x0b, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x36, 0x0a, 0x13, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x07, 0x66, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x46, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x52, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x22, 0x39, 0x0a, 0x06, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3e, 0x0a, 0x13, 0x49, 0x6e, 0x76, 0x69, 0x74, + 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, + 0x0a, 0x0f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x69, 0x63, 0x6b, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x72, 0x4e, 0x69, 0x63, 0x6b, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x14, 0x49, 0x6e, 0x76, 0x69, 0x74, + 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x49, 0x64, 0x22, 0x4b, 0x0a, 0x1c, + 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x0a, + 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0b, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x69, + 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x6e, 0x76, + 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x5f, 0x6e, 0x69, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x69, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, + 0x1d, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x31, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x31, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x32, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, + 0x72, 0x32, 0x49, 0x64, 0x22, 0x3e, 0x0a, 0x1f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x49, 0x6e, + 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x69, 0x74, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x76, 0x69, + 0x74, 0x65, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x17, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, + 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x49, 0x64, 0x32, 0xad, 0x05, 0x0a, + 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, + 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x14, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x2a, 0x18, 0x2f, 0x76, 0x31, 0x2f, + 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x7b, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x43, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x12, 0x0c, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x13, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, + 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x59, 0x0a, 0x0c, 0x49, 0x6e, 0x76, + 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x14, 0x2e, 0x49, 0x6e, 0x76, 0x69, + 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x15, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, + 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x69, 0x6e, 0x76, 0x69, 0x74, + 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x5e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x2e, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x69, 0x6e, + 0x76, 0x69, 0x74, 0x65, 0x12, 0x5a, 0x0a, 0x16, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x49, 0x6e, + 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x12, 0x1e, + 0x2e, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, + 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x12, 0x7c, 0x0a, 0x18, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x12, 0x20, 0x2e, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, + 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x30, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2a, 0x2a, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x2f, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x7b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x6c, + 0x0a, 0x10, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x18, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x2a, 0x2a, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x72, + 0x65, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x7b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x42, 0x1e, 0x5a, 0x1c, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x70, 0x65, 0x65, 0x64, + 0x52, 0x65, 0x61, 0x63, 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_friend_proto_rawDescOnce sync.Once + file_friend_proto_rawDescData = file_friend_proto_rawDesc +) + +func file_friend_proto_rawDescGZIP() []byte { + file_friend_proto_rawDescOnce.Do(func() { + file_friend_proto_rawDescData = protoimpl.X.CompressGZIP(file_friend_proto_rawDescData) + }) + return file_friend_proto_rawDescData +} + +var file_friend_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_friend_proto_goTypes = []interface{}{ + (*FriendEmpty)(nil), // 0: FriendEmpty + (*DeleteFriendRequest)(nil), // 1: DeleteFriendRequest + (*ListFriendResponse)(nil), // 2: ListFriendResponse + (*Friend)(nil), // 3: Friend + (*InviteFriendRequest)(nil), // 4: InviteFriendRequest + (*InviteFriendResponse)(nil), // 5: InviteFriendResponse + (*ListFriendInvitationResponse)(nil), // 6: ListFriendInvitationResponse + (*Invitation)(nil), // 7: Invitation + (*AcceptInvitationPost_Request)(nil), // 8: AcceptInvitation_post_Request + (*AcceptInvitationDelete_Request)(nil), // 9: AcceptInvitation_delete_Request + (*RejectInvitationRequest)(nil), // 10: RejectInvitationRequest +} +var file_friend_proto_depIdxs = []int32{ + 3, // 0: ListFriendResponse.friends:type_name -> Friend + 7, // 1: ListFriendInvitationResponse.invitation:type_name -> Invitation + 1, // 2: FriendService.DeleteFriend:input_type -> DeleteFriendRequest + 0, // 3: FriendService.ListFriend:input_type -> FriendEmpty + 4, // 4: FriendService.InviteFriend:input_type -> InviteFriendRequest + 0, // 5: FriendService.ListFriendInvitation:input_type -> FriendEmpty + 8, // 6: FriendService.AcceptInvitation_post_:input_type -> AcceptInvitation_post_Request + 9, // 7: FriendService.AcceptInvitation_delete_:input_type -> AcceptInvitation_delete_Request + 10, // 8: FriendService.RejectInvitation:input_type -> RejectInvitationRequest + 0, // 9: FriendService.DeleteFriend:output_type -> FriendEmpty + 2, // 10: FriendService.ListFriend:output_type -> ListFriendResponse + 5, // 11: FriendService.InviteFriend:output_type -> InviteFriendResponse + 6, // 12: FriendService.ListFriendInvitation:output_type -> ListFriendInvitationResponse + 0, // 13: FriendService.AcceptInvitation_post_:output_type -> FriendEmpty + 0, // 14: FriendService.AcceptInvitation_delete_:output_type -> FriendEmpty + 0, // 15: FriendService.RejectInvitation:output_type -> FriendEmpty + 9, // [9:16] is the sub-list for method output_type + 2, // [2:9] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_friend_proto_init() } +func file_friend_proto_init() { + if File_friend_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_friend_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendEmpty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteFriendRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFriendResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Friend); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InviteFriendRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InviteFriendResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFriendInvitationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Invitation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcceptInvitationPost_Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcceptInvitationDelete_Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RejectInvitationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_friend_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_friend_proto_goTypes, + DependencyIndexes: file_friend_proto_depIdxs, + MessageInfos: file_friend_proto_msgTypes, + }.Build() + File_friend_proto = out.File + file_friend_proto_rawDesc = nil + file_friend_proto_goTypes = nil + file_friend_proto_depIdxs = nil +} diff --git a/protobuf/gen/go/friend.pb.gw.go b/protobuf/gen/go/friend.pb.gw.go new file mode 100644 index 0000000..498fcf0 --- /dev/null +++ b/protobuf/gen/go/friend.pb.gw.go @@ -0,0 +1,697 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: friend.proto + +/* +Package monify is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package monify + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_FriendService_DeleteFriend_0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteFriendRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["relation_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "relation_id") + } + + protoReq.RelationId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "relation_id", err) + } + + msg, err := client.DeleteFriend(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_DeleteFriend_0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteFriendRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["relation_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "relation_id") + } + + protoReq.RelationId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "relation_id", err) + } + + msg, err := server.DeleteFriend(ctx, &protoReq) + return msg, metadata, err + +} + +func request_FriendService_ListFriend_0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq FriendEmpty + var metadata runtime.ServerMetadata + + msg, err := client.ListFriend(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_ListFriend_0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq FriendEmpty + var metadata runtime.ServerMetadata + + msg, err := server.ListFriend(ctx, &protoReq) + return msg, metadata, err + +} + +func request_FriendService_InviteFriend_0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq InviteFriendRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.InviteFriend(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_InviteFriend_0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq InviteFriendRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.InviteFriend(ctx, &protoReq) + return msg, metadata, err + +} + +func request_FriendService_ListFriendInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq FriendEmpty + var metadata runtime.ServerMetadata + + msg, err := client.ListFriendInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_ListFriendInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq FriendEmpty + var metadata runtime.ServerMetadata + + msg, err := server.ListFriendInvitation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_FriendService_AcceptInvitationPost__0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_FriendService_AcceptInvitationPost__0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AcceptInvitationPost_Request + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FriendService_AcceptInvitationPost__0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AcceptInvitationPost_(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_AcceptInvitationPost__0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AcceptInvitationPost_Request + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FriendService_AcceptInvitationPost__0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AcceptInvitationPost_(ctx, &protoReq) + return msg, metadata, err + +} + +func request_FriendService_AcceptInvitationDelete__0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AcceptInvitationDelete_Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["invite_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "invite_id") + } + + protoReq.InviteId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "invite_id", err) + } + + msg, err := client.AcceptInvitationDelete_(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_AcceptInvitationDelete__0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AcceptInvitationDelete_Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["invite_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "invite_id") + } + + protoReq.InviteId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "invite_id", err) + } + + msg, err := server.AcceptInvitationDelete_(ctx, &protoReq) + return msg, metadata, err + +} + +func request_FriendService_RejectInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client FriendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RejectInvitationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["invite_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "invite_id") + } + + protoReq.InviteId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "invite_id", err) + } + + msg, err := client.RejectInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FriendService_RejectInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server FriendServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RejectInvitationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["invite_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "invite_id") + } + + protoReq.InviteId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "invite_id", err) + } + + msg, err := server.RejectInvitation(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterFriendServiceHandlerServer registers the http handlers for service FriendService to "mux". +// UnaryRPC :call FriendServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFriendServiceHandlerFromEndpoint instead. +func RegisterFriendServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FriendServiceServer) error { + + mux.Handle("DELETE", pattern_FriendService_DeleteFriend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/DeleteFriend", runtime.WithHTTPPathPattern("/v1/friend/{relation_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_DeleteFriend_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_DeleteFriend_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_FriendService_ListFriend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/ListFriend", runtime.WithHTTPPathPattern("/v1/friend")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_ListFriend_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_ListFriend_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FriendService_InviteFriend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/InviteFriend", runtime.WithHTTPPathPattern("/v1/friend/invite")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_InviteFriend_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_InviteFriend_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_FriendService_ListFriendInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/ListFriendInvitation", runtime.WithHTTPPathPattern("/v1/friend/invite")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_ListFriendInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_ListFriendInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FriendService_AcceptInvitationPost__0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/AcceptInvitationPost_", runtime.WithHTTPPathPattern("/v1/friend")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_AcceptInvitationPost__0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_AcceptInvitationPost__0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_FriendService_AcceptInvitationDelete__0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/AcceptInvitationDelete_", runtime.WithHTTPPathPattern("/v1/friend/accept_invitation/{invite_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_AcceptInvitationDelete__0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_AcceptInvitationDelete__0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_FriendService_RejectInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.FriendService/RejectInvitation", runtime.WithHTTPPathPattern("/v1/friend/reject_invitation/{invite_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FriendService_RejectInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_RejectInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterFriendServiceHandlerFromEndpoint is same as RegisterFriendServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterFriendServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterFriendServiceHandler(ctx, mux, conn) +} + +// RegisterFriendServiceHandler registers the http handlers for service FriendService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterFriendServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterFriendServiceHandlerClient(ctx, mux, NewFriendServiceClient(conn)) +} + +// RegisterFriendServiceHandlerClient registers the http handlers for service FriendService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FriendServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FriendServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "FriendServiceClient" to call the correct interceptors. +func RegisterFriendServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FriendServiceClient) error { + + mux.Handle("DELETE", pattern_FriendService_DeleteFriend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/DeleteFriend", runtime.WithHTTPPathPattern("/v1/friend/{relation_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_DeleteFriend_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_DeleteFriend_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_FriendService_ListFriend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/ListFriend", runtime.WithHTTPPathPattern("/v1/friend")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_ListFriend_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_ListFriend_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FriendService_InviteFriend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/InviteFriend", runtime.WithHTTPPathPattern("/v1/friend/invite")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_InviteFriend_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_InviteFriend_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_FriendService_ListFriendInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/ListFriendInvitation", runtime.WithHTTPPathPattern("/v1/friend/invite")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_ListFriendInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_ListFriendInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FriendService_AcceptInvitationPost__0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/AcceptInvitationPost_", runtime.WithHTTPPathPattern("/v1/friend")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_AcceptInvitationPost__0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_AcceptInvitationPost__0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_FriendService_AcceptInvitationDelete__0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/AcceptInvitationDelete_", runtime.WithHTTPPathPattern("/v1/friend/accept_invitation/{invite_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_AcceptInvitationDelete__0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_AcceptInvitationDelete__0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_FriendService_RejectInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.FriendService/RejectInvitation", runtime.WithHTTPPathPattern("/v1/friend/reject_invitation/{invite_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_FriendService_RejectInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_FriendService_RejectInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_FriendService_DeleteFriend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "friend", "relation_id"}, "")) + + pattern_FriendService_ListFriend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "friend"}, "")) + + pattern_FriendService_InviteFriend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "friend", "invite"}, "")) + + pattern_FriendService_ListFriendInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "friend", "invite"}, "")) + + pattern_FriendService_AcceptInvitationPost__0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "friend"}, "")) + + pattern_FriendService_AcceptInvitationDelete__0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "friend", "accept_invitation", "invite_id"}, "")) + + pattern_FriendService_RejectInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "friend", "reject_invitation", "invite_id"}, "")) +) + +var ( + forward_FriendService_DeleteFriend_0 = runtime.ForwardResponseMessage + + forward_FriendService_ListFriend_0 = runtime.ForwardResponseMessage + + forward_FriendService_InviteFriend_0 = runtime.ForwardResponseMessage + + forward_FriendService_ListFriendInvitation_0 = runtime.ForwardResponseMessage + + forward_FriendService_AcceptInvitationPost__0 = runtime.ForwardResponseMessage + + forward_FriendService_AcceptInvitationDelete__0 = runtime.ForwardResponseMessage + + forward_FriendService_RejectInvitation_0 = runtime.ForwardResponseMessage +) diff --git a/protobuf/gen/go/friend_grpc.pb.go b/protobuf/gen/go/friend_grpc.pb.go new file mode 100644 index 0000000..7c5cbd9 --- /dev/null +++ b/protobuf/gen/go/friend_grpc.pb.go @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.27.0 +// source: friend.proto + +package monify + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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 + +// FriendServiceClient is the client API for FriendService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type FriendServiceClient interface { + DeleteFriend(ctx context.Context, in *DeleteFriendRequest, opts ...grpc.CallOption) (*FriendEmpty, error) + ListFriend(ctx context.Context, in *FriendEmpty, opts ...grpc.CallOption) (*ListFriendResponse, error) + InviteFriend(ctx context.Context, in *InviteFriendRequest, opts ...grpc.CallOption) (*InviteFriendResponse, error) + ListFriendInvitation(ctx context.Context, in *FriendEmpty, opts ...grpc.CallOption) (*ListFriendInvitationResponse, error) + // Add the record on the table(friend) + AcceptInvitationPost_(ctx context.Context, in *AcceptInvitationPost_Request, opts ...grpc.CallOption) (*FriendEmpty, error) + // Delete the record from the table(friend invite) + AcceptInvitationDelete_(ctx context.Context, in *AcceptInvitationDelete_Request, opts ...grpc.CallOption) (*FriendEmpty, error) + RejectInvitation(ctx context.Context, in *RejectInvitationRequest, opts ...grpc.CallOption) (*FriendEmpty, error) +} + +type friendServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFriendServiceClient(cc grpc.ClientConnInterface) FriendServiceClient { + return &friendServiceClient{cc} +} + +func (c *friendServiceClient) DeleteFriend(ctx context.Context, in *DeleteFriendRequest, opts ...grpc.CallOption) (*FriendEmpty, error) { + out := new(FriendEmpty) + err := c.cc.Invoke(ctx, "/FriendService/DeleteFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *friendServiceClient) ListFriend(ctx context.Context, in *FriendEmpty, opts ...grpc.CallOption) (*ListFriendResponse, error) { + out := new(ListFriendResponse) + err := c.cc.Invoke(ctx, "/FriendService/ListFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *friendServiceClient) InviteFriend(ctx context.Context, in *InviteFriendRequest, opts ...grpc.CallOption) (*InviteFriendResponse, error) { + out := new(InviteFriendResponse) + err := c.cc.Invoke(ctx, "/FriendService/InviteFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *friendServiceClient) ListFriendInvitation(ctx context.Context, in *FriendEmpty, opts ...grpc.CallOption) (*ListFriendInvitationResponse, error) { + out := new(ListFriendInvitationResponse) + err := c.cc.Invoke(ctx, "/FriendService/ListFriendInvitation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *friendServiceClient) AcceptInvitationPost_(ctx context.Context, in *AcceptInvitationPost_Request, opts ...grpc.CallOption) (*FriendEmpty, error) { + out := new(FriendEmpty) + err := c.cc.Invoke(ctx, "/FriendService/AcceptInvitation_post_", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *friendServiceClient) AcceptInvitationDelete_(ctx context.Context, in *AcceptInvitationDelete_Request, opts ...grpc.CallOption) (*FriendEmpty, error) { + out := new(FriendEmpty) + err := c.cc.Invoke(ctx, "/FriendService/AcceptInvitation_delete_", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *friendServiceClient) RejectInvitation(ctx context.Context, in *RejectInvitationRequest, opts ...grpc.CallOption) (*FriendEmpty, error) { + out := new(FriendEmpty) + err := c.cc.Invoke(ctx, "/FriendService/RejectInvitation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FriendServiceServer is the server API for FriendService service. +// All implementations must embed UnimplementedFriendServiceServer +// for forward compatibility +type FriendServiceServer interface { + DeleteFriend(context.Context, *DeleteFriendRequest) (*FriendEmpty, error) + ListFriend(context.Context, *FriendEmpty) (*ListFriendResponse, error) + InviteFriend(context.Context, *InviteFriendRequest) (*InviteFriendResponse, error) + ListFriendInvitation(context.Context, *FriendEmpty) (*ListFriendInvitationResponse, error) + // Add the record on the table(friend) + AcceptInvitationPost_(context.Context, *AcceptInvitationPost_Request) (*FriendEmpty, error) + // Delete the record from the table(friend invite) + AcceptInvitationDelete_(context.Context, *AcceptInvitationDelete_Request) (*FriendEmpty, error) + RejectInvitation(context.Context, *RejectInvitationRequest) (*FriendEmpty, error) + mustEmbedUnimplementedFriendServiceServer() +} + +// UnimplementedFriendServiceServer must be embedded to have forward compatible implementations. +type UnimplementedFriendServiceServer struct { +} + +func (UnimplementedFriendServiceServer) DeleteFriend(context.Context, *DeleteFriendRequest) (*FriendEmpty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteFriend not implemented") +} +func (UnimplementedFriendServiceServer) ListFriend(context.Context, *FriendEmpty) (*ListFriendResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListFriend not implemented") +} +func (UnimplementedFriendServiceServer) InviteFriend(context.Context, *InviteFriendRequest) (*InviteFriendResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InviteFriend not implemented") +} +func (UnimplementedFriendServiceServer) ListFriendInvitation(context.Context, *FriendEmpty) (*ListFriendInvitationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListFriendInvitation not implemented") +} +func (UnimplementedFriendServiceServer) AcceptInvitationPost_(context.Context, *AcceptInvitationPost_Request) (*FriendEmpty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AcceptInvitationPost_ not implemented") +} +func (UnimplementedFriendServiceServer) AcceptInvitationDelete_(context.Context, *AcceptInvitationDelete_Request) (*FriendEmpty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AcceptInvitationDelete_ not implemented") +} +func (UnimplementedFriendServiceServer) RejectInvitation(context.Context, *RejectInvitationRequest) (*FriendEmpty, error) { + return nil, status.Errorf(codes.Unimplemented, "method RejectInvitation not implemented") +} +func (UnimplementedFriendServiceServer) mustEmbedUnimplementedFriendServiceServer() {} + +// UnsafeFriendServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FriendServiceServer will +// result in compilation errors. +type UnsafeFriendServiceServer interface { + mustEmbedUnimplementedFriendServiceServer() +} + +func RegisterFriendServiceServer(s grpc.ServiceRegistrar, srv FriendServiceServer) { + s.RegisterService(&FriendService_ServiceDesc, srv) +} + +func _FriendService_DeleteFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteFriendRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).DeleteFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/DeleteFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).DeleteFriend(ctx, req.(*DeleteFriendRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FriendService_ListFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FriendEmpty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).ListFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/ListFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).ListFriend(ctx, req.(*FriendEmpty)) + } + return interceptor(ctx, in, info, handler) +} + +func _FriendService_InviteFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InviteFriendRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).InviteFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/InviteFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).InviteFriend(ctx, req.(*InviteFriendRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FriendService_ListFriendInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FriendEmpty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).ListFriendInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/ListFriendInvitation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).ListFriendInvitation(ctx, req.(*FriendEmpty)) + } + return interceptor(ctx, in, info, handler) +} + +func _FriendService_AcceptInvitationPost__Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AcceptInvitationPost_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).AcceptInvitationPost_(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/AcceptInvitation_post_", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).AcceptInvitationPost_(ctx, req.(*AcceptInvitationPost_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _FriendService_AcceptInvitationDelete__Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AcceptInvitationDelete_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).AcceptInvitationDelete_(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/AcceptInvitation_delete_", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).AcceptInvitationDelete_(ctx, req.(*AcceptInvitationDelete_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _FriendService_RejectInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RejectInvitationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FriendServiceServer).RejectInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/FriendService/RejectInvitation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FriendServiceServer).RejectInvitation(ctx, req.(*RejectInvitationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// FriendService_ServiceDesc is the grpc.ServiceDesc for FriendService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FriendService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "FriendService", + HandlerType: (*FriendServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "DeleteFriend", + Handler: _FriendService_DeleteFriend_Handler, + }, + { + MethodName: "ListFriend", + Handler: _FriendService_ListFriend_Handler, + }, + { + MethodName: "InviteFriend", + Handler: _FriendService_InviteFriend_Handler, + }, + { + MethodName: "ListFriendInvitation", + Handler: _FriendService_ListFriendInvitation_Handler, + }, + { + MethodName: "AcceptInvitation_post_", + Handler: _FriendService_AcceptInvitationPost__Handler, + }, + { + MethodName: "AcceptInvitation_delete_", + Handler: _FriendService_AcceptInvitationDelete__Handler, + }, + { + MethodName: "RejectInvitation", + Handler: _FriendService_RejectInvitation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "friend.proto", +} diff --git a/protobuf/gen/go/group.pb.go b/protobuf/gen/go/group.pb.go index ad8e0c0..cf8f9be 100644 --- a/protobuf/gen/go/group.pb.go +++ b/protobuf/gen/go/group.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc-gen-go v1.28.1 +// protoc v5.27.0 // source: group.proto package monify @@ -1162,8 +1162,8 @@ var file_group_proto_rawDesc = []byte{ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x01, 0x2a, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x12, 0x60, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x65, + 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x3a, 0x01, 0x2a, 0x12, 0x60, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x92, 0x41, 0x0e, 0x62, @@ -1175,15 +1175,15 @@ var file_group_proto_rawDesc = []byte{ 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, - 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, - 0x2a, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x69, 0x6e, 0x76, - 0x69, 0x74, 0x65, 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x5e, 0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, + 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, + 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x5e, 0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x11, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x70, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x47, + 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x70, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, diff --git a/protobuf/gen/go/group_bill.pb.go b/protobuf/gen/go/group_bill.pb.go index e95cc7d..a275c6b 100644 --- a/protobuf/gen/go/group_bill.pb.go +++ b/protobuf/gen/go/group_bill.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc-gen-go v1.28.1 +// protoc v5.27.0 // source: group_bill.proto package monify @@ -1317,8 +1317,8 @@ var file_group_bill_proto_rawDesc = []byte{ 0x18, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x73, 0x5f, 0x62, 0x69, 0x6c, 0x6c, 0x12, 0x68, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, + 0x02, 0x14, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x5f, 0x62, + 0x69, 0x6c, 0x6c, 0x3a, 0x01, 0x2a, 0x12, 0x68, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x12, 0x15, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x52, 0x65, @@ -1338,8 +1338,8 @@ var file_group_bill_proto_rawDesc = []byte{ 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x69, 0x6c, 0x6c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x35, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1e, 0x3a, 0x01, 0x2a, 0x1a, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x5f, 0x62, 0x69, 0x6c, 0x6c, 0x2f, 0x7b, 0x62, 0x69, 0x6c, 0x6c, 0x5f, 0x69, 0x64, 0x7d, 0x12, + 0x1e, 0x1a, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x5f, 0x62, 0x69, + 0x6c, 0x6c, 0x2f, 0x7b, 0x62, 0x69, 0x6c, 0x6c, 0x5f, 0x69, 0x64, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x67, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, diff --git a/protobuf/gen/go/group_bill_grpc.pb.go b/protobuf/gen/go/group_bill_grpc.pb.go index eca62b9..4b73fb4 100644 --- a/protobuf/gen/go/group_bill_grpc.pb.go +++ b/protobuf/gen/go/group_bill_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.27.0 // source: group_bill.proto package monify @@ -18,14 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - GroupsBillService_CreateGroupBill_FullMethodName = "/GroupsBillService/CreateGroupBill" - GroupsBillService_GetGroupBills_FullMethodName = "/GroupsBillService/GetGroupBills" - GroupsBillService_DeleteGroupBill_FullMethodName = "/GroupsBillService/DeleteGroupBill" - GroupsBillService_ModifyGroupBill_FullMethodName = "/GroupsBillService/ModifyGroupBill" - GroupsBillService_GetHistory_FullMethodName = "/GroupsBillService/GetHistory" -) - // GroupsBillServiceClient is the client API for GroupsBillService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -47,7 +39,7 @@ func NewGroupsBillServiceClient(cc grpc.ClientConnInterface) GroupsBillServiceCl func (c *groupsBillServiceClient) CreateGroupBill(ctx context.Context, in *CreateGroupBillRequest, opts ...grpc.CallOption) (*CreateGroupBillResponse, error) { out := new(CreateGroupBillResponse) - err := c.cc.Invoke(ctx, GroupsBillService_CreateGroupBill_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupsBillService/CreateGroupBill", in, out, opts...) if err != nil { return nil, err } @@ -56,7 +48,7 @@ func (c *groupsBillServiceClient) CreateGroupBill(ctx context.Context, in *Creat func (c *groupsBillServiceClient) GetGroupBills(ctx context.Context, in *GetGroupBillsRequest, opts ...grpc.CallOption) (*GetGroupBillsResponse, error) { out := new(GetGroupBillsResponse) - err := c.cc.Invoke(ctx, GroupsBillService_GetGroupBills_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupsBillService/GetGroupBills", in, out, opts...) if err != nil { return nil, err } @@ -65,7 +57,7 @@ func (c *groupsBillServiceClient) GetGroupBills(ctx context.Context, in *GetGrou func (c *groupsBillServiceClient) DeleteGroupBill(ctx context.Context, in *DeleteGroupBillRequest, opts ...grpc.CallOption) (*GroupGroupBillEmpty, error) { out := new(GroupGroupBillEmpty) - err := c.cc.Invoke(ctx, GroupsBillService_DeleteGroupBill_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupsBillService/DeleteGroupBill", in, out, opts...) if err != nil { return nil, err } @@ -74,7 +66,7 @@ func (c *groupsBillServiceClient) DeleteGroupBill(ctx context.Context, in *Delet func (c *groupsBillServiceClient) ModifyGroupBill(ctx context.Context, in *ModifyGroupBillRequest, opts ...grpc.CallOption) (*GroupGroupBillEmpty, error) { out := new(GroupGroupBillEmpty) - err := c.cc.Invoke(ctx, GroupsBillService_ModifyGroupBill_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupsBillService/ModifyGroupBill", in, out, opts...) if err != nil { return nil, err } @@ -83,7 +75,7 @@ func (c *groupsBillServiceClient) ModifyGroupBill(ctx context.Context, in *Modif func (c *groupsBillServiceClient) GetHistory(ctx context.Context, in *GetHistoryRequest, opts ...grpc.CallOption) (*GetHistoryResponse, error) { out := new(GetHistoryResponse) - err := c.cc.Invoke(ctx, GroupsBillService_GetHistory_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupsBillService/GetHistory", in, out, opts...) if err != nil { return nil, err } @@ -144,7 +136,7 @@ func _GroupsBillService_CreateGroupBill_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupsBillService_CreateGroupBill_FullMethodName, + FullMethod: "/GroupsBillService/CreateGroupBill", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupsBillServiceServer).CreateGroupBill(ctx, req.(*CreateGroupBillRequest)) @@ -162,7 +154,7 @@ func _GroupsBillService_GetGroupBills_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupsBillService_GetGroupBills_FullMethodName, + FullMethod: "/GroupsBillService/GetGroupBills", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupsBillServiceServer).GetGroupBills(ctx, req.(*GetGroupBillsRequest)) @@ -180,7 +172,7 @@ func _GroupsBillService_DeleteGroupBill_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupsBillService_DeleteGroupBill_FullMethodName, + FullMethod: "/GroupsBillService/DeleteGroupBill", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupsBillServiceServer).DeleteGroupBill(ctx, req.(*DeleteGroupBillRequest)) @@ -198,7 +190,7 @@ func _GroupsBillService_ModifyGroupBill_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupsBillService_ModifyGroupBill_FullMethodName, + FullMethod: "/GroupsBillService/ModifyGroupBill", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupsBillServiceServer).ModifyGroupBill(ctx, req.(*ModifyGroupBillRequest)) @@ -216,7 +208,7 @@ func _GroupsBillService_GetHistory_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupsBillService_GetHistory_FullMethodName, + FullMethod: "/GroupsBillService/GetHistory", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupsBillServiceServer).GetHistory(ctx, req.(*GetHistoryRequest)) diff --git a/protobuf/gen/go/group_grpc.pb.go b/protobuf/gen/go/group_grpc.pb.go index 955f21b..ab8c874 100644 --- a/protobuf/gen/go/group_grpc.pb.go +++ b/protobuf/gen/go/group_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.27.0 // source: group.proto package monify @@ -18,19 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - GroupService_CreateGroup_FullMethodName = "/GroupService/CreateGroup" - GroupService_ListJoinedGroups_FullMethodName = "/GroupService/ListJoinedGroups" - GroupService_GenerateInviteCode_FullMethodName = "/GroupService/GenerateInviteCode" - GroupService_JoinGroup_FullMethodName = "/GroupService/JoinGroup" - GroupService_GetGroupMembers_FullMethodName = "/GroupService/GetGroupMembers" - GroupService_DeleteGroup_FullMethodName = "/GroupService/DeleteGroup" - GroupService_DeleteInviteCode_FullMethodName = "/GroupService/DeleteInviteCode" - GroupService_GetInviteCode_FullMethodName = "/GroupService/GetInviteCode" - GroupService_GetGroupInfo_FullMethodName = "/GroupService/GetGroupInfo" - GroupService_GetGroupByInviteCode_FullMethodName = "/GroupService/GetGroupByInviteCode" -) - // GroupServiceClient is the client API for GroupService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -57,7 +44,7 @@ func NewGroupServiceClient(cc grpc.ClientConnInterface) GroupServiceClient { func (c *groupServiceClient) CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...grpc.CallOption) (*CreateGroupResponse, error) { out := new(CreateGroupResponse) - err := c.cc.Invoke(ctx, GroupService_CreateGroup_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/CreateGroup", in, out, opts...) if err != nil { return nil, err } @@ -66,7 +53,7 @@ func (c *groupServiceClient) CreateGroup(ctx context.Context, in *CreateGroupReq func (c *groupServiceClient) ListJoinedGroups(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListJoinedGroupsResponse, error) { out := new(ListJoinedGroupsResponse) - err := c.cc.Invoke(ctx, GroupService_ListJoinedGroups_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/ListJoinedGroups", in, out, opts...) if err != nil { return nil, err } @@ -75,7 +62,7 @@ func (c *groupServiceClient) ListJoinedGroups(ctx context.Context, in *Empty, op func (c *groupServiceClient) GenerateInviteCode(ctx context.Context, in *GenerateInviteCodeRequest, opts ...grpc.CallOption) (*GenerateInviteCodeResponse, error) { out := new(GenerateInviteCodeResponse) - err := c.cc.Invoke(ctx, GroupService_GenerateInviteCode_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/GenerateInviteCode", in, out, opts...) if err != nil { return nil, err } @@ -84,7 +71,7 @@ func (c *groupServiceClient) GenerateInviteCode(ctx context.Context, in *Generat func (c *groupServiceClient) JoinGroup(ctx context.Context, in *JoinGroupRequest, opts ...grpc.CallOption) (*JoinGroupResponse, error) { out := new(JoinGroupResponse) - err := c.cc.Invoke(ctx, GroupService_JoinGroup_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/JoinGroup", in, out, opts...) if err != nil { return nil, err } @@ -93,7 +80,7 @@ func (c *groupServiceClient) JoinGroup(ctx context.Context, in *JoinGroupRequest func (c *groupServiceClient) GetGroupMembers(ctx context.Context, in *GetGroupMembersRequest, opts ...grpc.CallOption) (*GetGroupMembersResponse, error) { out := new(GetGroupMembersResponse) - err := c.cc.Invoke(ctx, GroupService_GetGroupMembers_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/GetGroupMembers", in, out, opts...) if err != nil { return nil, err } @@ -102,7 +89,7 @@ func (c *groupServiceClient) GetGroupMembers(ctx context.Context, in *GetGroupMe func (c *groupServiceClient) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, GroupService_DeleteGroup_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/DeleteGroup", in, out, opts...) if err != nil { return nil, err } @@ -111,7 +98,7 @@ func (c *groupServiceClient) DeleteGroup(ctx context.Context, in *DeleteGroupReq func (c *groupServiceClient) DeleteInviteCode(ctx context.Context, in *DeleteInviteCodeRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, GroupService_DeleteInviteCode_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/DeleteInviteCode", in, out, opts...) if err != nil { return nil, err } @@ -120,7 +107,7 @@ func (c *groupServiceClient) DeleteInviteCode(ctx context.Context, in *DeleteInv func (c *groupServiceClient) GetInviteCode(ctx context.Context, in *GetInviteCodeRequest, opts ...grpc.CallOption) (*GetInviteCodeResponse, error) { out := new(GetInviteCodeResponse) - err := c.cc.Invoke(ctx, GroupService_GetInviteCode_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/GetInviteCode", in, out, opts...) if err != nil { return nil, err } @@ -129,7 +116,7 @@ func (c *groupServiceClient) GetInviteCode(ctx context.Context, in *GetInviteCod func (c *groupServiceClient) GetGroupInfo(ctx context.Context, in *GetGroupInfoRequest, opts ...grpc.CallOption) (*GetGroupInfoResponse, error) { out := new(GetGroupInfoResponse) - err := c.cc.Invoke(ctx, GroupService_GetGroupInfo_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/GetGroupInfo", in, out, opts...) if err != nil { return nil, err } @@ -138,7 +125,7 @@ func (c *groupServiceClient) GetGroupInfo(ctx context.Context, in *GetGroupInfoR func (c *groupServiceClient) GetGroupByInviteCode(ctx context.Context, in *GetGroupByInviteCodeRequest, opts ...grpc.CallOption) (*GetGroupInfoResponse, error) { out := new(GetGroupInfoResponse) - err := c.cc.Invoke(ctx, GroupService_GetGroupByInviteCode_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/GroupService/GetGroupByInviteCode", in, out, opts...) if err != nil { return nil, err } @@ -219,7 +206,7 @@ func _GroupService_CreateGroup_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_CreateGroup_FullMethodName, + FullMethod: "/GroupService/CreateGroup", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).CreateGroup(ctx, req.(*CreateGroupRequest)) @@ -237,7 +224,7 @@ func _GroupService_ListJoinedGroups_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_ListJoinedGroups_FullMethodName, + FullMethod: "/GroupService/ListJoinedGroups", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).ListJoinedGroups(ctx, req.(*Empty)) @@ -255,7 +242,7 @@ func _GroupService_GenerateInviteCode_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_GenerateInviteCode_FullMethodName, + FullMethod: "/GroupService/GenerateInviteCode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).GenerateInviteCode(ctx, req.(*GenerateInviteCodeRequest)) @@ -273,7 +260,7 @@ func _GroupService_JoinGroup_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_JoinGroup_FullMethodName, + FullMethod: "/GroupService/JoinGroup", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).JoinGroup(ctx, req.(*JoinGroupRequest)) @@ -291,7 +278,7 @@ func _GroupService_GetGroupMembers_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_GetGroupMembers_FullMethodName, + FullMethod: "/GroupService/GetGroupMembers", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).GetGroupMembers(ctx, req.(*GetGroupMembersRequest)) @@ -309,7 +296,7 @@ func _GroupService_DeleteGroup_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_DeleteGroup_FullMethodName, + FullMethod: "/GroupService/DeleteGroup", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).DeleteGroup(ctx, req.(*DeleteGroupRequest)) @@ -327,7 +314,7 @@ func _GroupService_DeleteInviteCode_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_DeleteInviteCode_FullMethodName, + FullMethod: "/GroupService/DeleteInviteCode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).DeleteInviteCode(ctx, req.(*DeleteInviteCodeRequest)) @@ -345,7 +332,7 @@ func _GroupService_GetInviteCode_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_GetInviteCode_FullMethodName, + FullMethod: "/GroupService/GetInviteCode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).GetInviteCode(ctx, req.(*GetInviteCodeRequest)) @@ -363,7 +350,7 @@ func _GroupService_GetGroupInfo_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_GetGroupInfo_FullMethodName, + FullMethod: "/GroupService/GetGroupInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).GetGroupInfo(ctx, req.(*GetGroupInfoRequest)) @@ -381,7 +368,7 @@ func _GroupService_GetGroupByInviteCode_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: GroupService_GetGroupByInviteCode_FullMethodName, + FullMethod: "/GroupService/GetGroupByInviteCode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GroupServiceServer).GetGroupByInviteCode(ctx, req.(*GetGroupByInviteCodeRequest)) diff --git a/protobuf/gen/go/media.pb.go b/protobuf/gen/go/media.pb.go index 4777fb5..1e4b6c7 100644 --- a/protobuf/gen/go/media.pb.go +++ b/protobuf/gen/go/media.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc-gen-go v1.28.1 +// protoc v5.27.0 // source: media.proto package monify diff --git a/protobuf/gen/go/media_grpc.pb.go b/protobuf/gen/go/media_grpc.pb.go index edd59a4..4a8ede7 100644 --- a/protobuf/gen/go/media_grpc.pb.go +++ b/protobuf/gen/go/media_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.27.0 // source: media.proto package monify @@ -19,11 +19,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - MediaService_ConfirmFileUsage_FullMethodName = "/MediaService/ConfirmFileUsage" - MediaService_GetFileUrl_FullMethodName = "/MediaService/GetFileUrl" -) - // MediaServiceClient is the client API for MediaService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -42,7 +37,7 @@ func NewMediaServiceClient(cc grpc.ClientConnInterface) MediaServiceClient { func (c *mediaServiceClient) ConfirmFileUsage(ctx context.Context, in *ConfirmFileUsageRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, MediaService_ConfirmFileUsage_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/MediaService/ConfirmFileUsage", in, out, opts...) if err != nil { return nil, err } @@ -51,7 +46,7 @@ func (c *mediaServiceClient) ConfirmFileUsage(ctx context.Context, in *ConfirmFi func (c *mediaServiceClient) GetFileUrl(ctx context.Context, in *GetFileUrlRequest, opts ...grpc.CallOption) (*GetFileUrlResponse, error) { out := new(GetFileUrlResponse) - err := c.cc.Invoke(ctx, MediaService_GetFileUrl_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/MediaService/GetFileUrl", in, out, opts...) if err != nil { return nil, err } @@ -100,7 +95,7 @@ func _MediaService_ConfirmFileUsage_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: MediaService_ConfirmFileUsage_FullMethodName, + FullMethod: "/MediaService/ConfirmFileUsage", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MediaServiceServer).ConfirmFileUsage(ctx, req.(*ConfirmFileUsageRequest)) @@ -118,7 +113,7 @@ func _MediaService_GetFileUrl_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: MediaService_GetFileUrl_FullMethodName, + FullMethod: "/MediaService/GetFileUrl", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MediaServiceServer).GetFileUrl(ctx, req.(*GetFileUrlRequest)) diff --git a/protobuf/gen/go/user.pb.go b/protobuf/gen/go/user.pb.go index cc328fb..7cc52b2 100644 --- a/protobuf/gen/go/user.pb.go +++ b/protobuf/gen/go/user.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc-gen-go v1.28.1 +// protoc v5.27.0 // source: user.proto package monify @@ -114,6 +114,7 @@ type GetUserInfoResponse struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` AvatarUrl string `protobuf:"bytes,2,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` + NickId string `protobuf:"bytes,3,opt,name=nick_id,json=nickId,proto3" json:"nick_id,omitempty"` } func (x *GetUserInfoResponse) Reset() { @@ -162,6 +163,13 @@ func (x *GetUserInfoResponse) GetAvatarUrl() string { return "" } +func (x *GetUserInfoResponse) GetNickId() string { + if x != nil { + return x.NickId + } + return "" +} + type UpdateUserNameRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -350,6 +358,53 @@ func (x *UpdateUserAvatarRequest) GetImageId() string { return "" } +type UpdateUserNickIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NickId string `protobuf:"bytes,1,opt,name=nick_id,json=nickId,proto3" json:"nick_id,omitempty"` +} + +func (x *UpdateUserNickIdRequest) Reset() { + *x = UpdateUserNickIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserNickIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserNickIdRequest) ProtoMessage() {} + +func (x *UpdateUserNickIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserNickIdRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserNickIdRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateUserNickIdRequest) GetNickId() string { + if x != nil { + return x.NickId + } + return "" +} + var File_user_proto protoreflect.FileDescriptor var file_user_proto_rawDesc = []byte{ @@ -362,54 +417,65 @@ var file_user_proto_rawDesc = []byte{ 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, - 0x72, 0x49, 0x64, 0x22, 0x48, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, + 0x72, 0x49, 0x64, 0x22, 0x61, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x22, 0x2b, 0x0a, - 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 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, 0x22, 0x3a, 0x0a, 0x15, 0x41, 0x64, - 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x3d, 0x0a, 0x18, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x34, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, - 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x19, 0x0a, 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x32, 0xa1, 0x03, 0x0a, 0x0b, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x29, - 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, - 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x1a, 0x0d, 0x2f, 0x76, 0x31, 0x2f, - 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x10, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x18, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x2b, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, - 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x1a, 0x0f, 0x2f, 0x76, - 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x60, 0x0a, - 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x13, 0x2e, 0x47, - 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, - 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, - 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, - 0x33, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x16, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x2e, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, - 0x1e, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x70, - 0x65, 0x65, 0x64, 0x52, 0x65, 0x61, 0x63, 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x17, 0x0a, + 0x07, 0x6e, 0x69, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6e, 0x69, 0x63, 0x6b, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 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, 0x22, 0x3a, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x3d, 0x0a, 0x18, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x34, + 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, + 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x6d, 0x61, + 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x61, + 0x67, 0x65, 0x49, 0x64, 0x22, 0x32, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x4e, 0x69, 0x63, 0x6b, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x17, 0x0a, 0x07, 0x6e, 0x69, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6e, 0x69, 0x63, 0x6b, 0x49, 0x64, 0x32, 0x86, 0x04, 0x0a, 0x0b, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x29, 0x92, 0x41, 0x0e, + 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x12, 0x1a, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6e, + 0x61, 0x6d, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x62, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x18, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2b, 0x92, + 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x1a, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, + 0x2f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x60, 0x0a, 0x0b, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, + 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, + 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0e, + 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x16, + 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x00, 0x12, 0x39, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x10, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x69, 0x63, 0x6b, 0x49, 0x64, + 0x12, 0x18, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x69, 0x63, + 0x6b, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x55, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x2c, 0x92, 0x41, 0x0e, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, + 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x1a, 0x10, 0x2f, 0x76, + 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6e, 0x69, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x3a, 0x01, + 0x2a, 0x42, 0x1e, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x53, 0x70, 0x65, 0x65, 0x64, 0x52, 0x65, 0x61, 0x63, 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, + 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -424,7 +490,7 @@ func file_user_proto_rawDescGZIP() []byte { return file_user_proto_rawDescData } -var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_user_proto_goTypes = []interface{}{ (*UEmpty)(nil), // 0: UEmpty (*GetUserInfoRequest)(nil), // 1: GetUserInfoRequest @@ -433,6 +499,7 @@ var file_user_proto_goTypes = []interface{}{ (*AddDeviceTokenRequest)(nil), // 4: AddDeviceTokenRequest (*RemoveDeviceTokenRequest)(nil), // 5: RemoveDeviceTokenRequest (*UpdateUserAvatarRequest)(nil), // 6: UpdateUserAvatarRequest + (*UpdateUserNickIdRequest)(nil), // 7: UpdateUserNickIdRequest } var file_user_proto_depIdxs = []int32{ 3, // 0: UserService.UpdateUserName:input_type -> UpdateUserNameRequest @@ -440,13 +507,15 @@ var file_user_proto_depIdxs = []int32{ 1, // 2: UserService.GetUserInfo:input_type -> GetUserInfoRequest 4, // 3: UserService.AddDeviceToken:input_type -> AddDeviceTokenRequest 5, // 4: UserService.RemoveDeviceToken:input_type -> RemoveDeviceTokenRequest - 0, // 5: UserService.UpdateUserName:output_type -> UEmpty - 0, // 6: UserService.UpdateUserAvatar:output_type -> UEmpty - 2, // 7: UserService.GetUserInfo:output_type -> GetUserInfoResponse - 0, // 8: UserService.AddDeviceToken:output_type -> UEmpty - 0, // 9: UserService.RemoveDeviceToken:output_type -> UEmpty - 5, // [5:10] is the sub-list for method output_type - 0, // [0:5] is the sub-list for method input_type + 7, // 5: UserService.UpdateUserNickId:input_type -> UpdateUserNickIdRequest + 0, // 6: UserService.UpdateUserName:output_type -> UEmpty + 0, // 7: UserService.UpdateUserAvatar:output_type -> UEmpty + 2, // 8: UserService.GetUserInfo:output_type -> GetUserInfoResponse + 0, // 9: UserService.AddDeviceToken:output_type -> UEmpty + 0, // 10: UserService.RemoveDeviceToken:output_type -> UEmpty + 0, // 11: UserService.UpdateUserNickId:output_type -> UEmpty + 6, // [6:12] is the sub-list for method output_type + 0, // [0:6] 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,6 +611,18 @@ func file_user_proto_init() { return nil } } + file_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserNickIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -549,7 +630,7 @@ func file_user_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_user_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/protobuf/gen/go/user.pb.gw.go b/protobuf/gen/go/user.pb.gw.go index 32e9d33..e16dcd9 100644 --- a/protobuf/gen/go/user.pb.gw.go +++ b/protobuf/gen/go/user.pb.gw.go @@ -171,6 +171,32 @@ func local_request_UserService_RemoveDeviceToken_0(ctx context.Context, marshale } +func request_UserService_UpdateUserNickId_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateUserNickIdRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateUserNickId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_UpdateUserNickId_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateUserNickIdRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateUserNickId(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". // UnaryRPC :call UserServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -302,6 +328,31 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("PUT", pattern_UserService_UpdateUserNickId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.UserService/UpdateUserNickId", runtime.WithHTTPPathPattern("/v1/user/nick_id")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_UpdateUserNickId_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_UpdateUserNickId_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -453,6 +504,28 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("PUT", pattern_UserService_UpdateUserNickId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.UserService/UpdateUserNickId", runtime.WithHTTPPathPattern("/v1/user/nick_id")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_UpdateUserNickId_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_UpdateUserNickId_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -466,6 +539,8 @@ var ( pattern_UserService_AddDeviceToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"UserService", "AddDeviceToken"}, "")) pattern_UserService_RemoveDeviceToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"UserService", "RemoveDeviceToken"}, "")) + + pattern_UserService_UpdateUserNickId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "user", "nick_id"}, "")) ) var ( @@ -478,4 +553,6 @@ var ( forward_UserService_AddDeviceToken_0 = runtime.ForwardResponseMessage forward_UserService_RemoveDeviceToken_0 = runtime.ForwardResponseMessage + + forward_UserService_UpdateUserNickId_0 = runtime.ForwardResponseMessage ) diff --git a/protobuf/gen/go/user_grpc.pb.go b/protobuf/gen/go/user_grpc.pb.go index d35865e..748773b 100644 --- a/protobuf/gen/go/user_grpc.pb.go +++ b/protobuf/gen/go/user_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v5.27.0 // source: user.proto package monify @@ -18,14 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - UserService_UpdateUserName_FullMethodName = "/UserService/UpdateUserName" - UserService_UpdateUserAvatar_FullMethodName = "/UserService/UpdateUserAvatar" - UserService_GetUserInfo_FullMethodName = "/UserService/GetUserInfo" - UserService_AddDeviceToken_FullMethodName = "/UserService/AddDeviceToken" - UserService_RemoveDeviceToken_FullMethodName = "/UserService/RemoveDeviceToken" -) - // UserServiceClient is the client API for UserService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -35,6 +27,7 @@ type UserServiceClient interface { GetUserInfo(ctx context.Context, in *GetUserInfoRequest, opts ...grpc.CallOption) (*GetUserInfoResponse, error) AddDeviceToken(ctx context.Context, in *AddDeviceTokenRequest, opts ...grpc.CallOption) (*UEmpty, error) RemoveDeviceToken(ctx context.Context, in *RemoveDeviceTokenRequest, opts ...grpc.CallOption) (*UEmpty, error) + UpdateUserNickId(ctx context.Context, in *UpdateUserNickIdRequest, opts ...grpc.CallOption) (*UEmpty, error) } type userServiceClient struct { @@ -47,7 +40,7 @@ func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { func (c *userServiceClient) UpdateUserName(ctx context.Context, in *UpdateUserNameRequest, opts ...grpc.CallOption) (*UEmpty, error) { out := new(UEmpty) - err := c.cc.Invoke(ctx, UserService_UpdateUserName_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/UserService/UpdateUserName", in, out, opts...) if err != nil { return nil, err } @@ -56,7 +49,7 @@ func (c *userServiceClient) UpdateUserName(ctx context.Context, in *UpdateUserNa func (c *userServiceClient) UpdateUserAvatar(ctx context.Context, in *UpdateUserAvatarRequest, opts ...grpc.CallOption) (*UEmpty, error) { out := new(UEmpty) - err := c.cc.Invoke(ctx, UserService_UpdateUserAvatar_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/UserService/UpdateUserAvatar", in, out, opts...) if err != nil { return nil, err } @@ -65,7 +58,7 @@ func (c *userServiceClient) UpdateUserAvatar(ctx context.Context, in *UpdateUser func (c *userServiceClient) GetUserInfo(ctx context.Context, in *GetUserInfoRequest, opts ...grpc.CallOption) (*GetUserInfoResponse, error) { out := new(GetUserInfoResponse) - err := c.cc.Invoke(ctx, UserService_GetUserInfo_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/UserService/GetUserInfo", in, out, opts...) if err != nil { return nil, err } @@ -74,7 +67,7 @@ func (c *userServiceClient) GetUserInfo(ctx context.Context, in *GetUserInfoRequ func (c *userServiceClient) AddDeviceToken(ctx context.Context, in *AddDeviceTokenRequest, opts ...grpc.CallOption) (*UEmpty, error) { out := new(UEmpty) - err := c.cc.Invoke(ctx, UserService_AddDeviceToken_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/UserService/AddDeviceToken", in, out, opts...) if err != nil { return nil, err } @@ -83,7 +76,16 @@ func (c *userServiceClient) AddDeviceToken(ctx context.Context, in *AddDeviceTok func (c *userServiceClient) RemoveDeviceToken(ctx context.Context, in *RemoveDeviceTokenRequest, opts ...grpc.CallOption) (*UEmpty, error) { out := new(UEmpty) - err := c.cc.Invoke(ctx, UserService_RemoveDeviceToken_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/UserService/RemoveDeviceToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUserNickId(ctx context.Context, in *UpdateUserNickIdRequest, opts ...grpc.CallOption) (*UEmpty, error) { + out := new(UEmpty) + err := c.cc.Invoke(ctx, "/UserService/UpdateUserNickId", in, out, opts...) if err != nil { return nil, err } @@ -99,6 +101,7 @@ type UserServiceServer interface { GetUserInfo(context.Context, *GetUserInfoRequest) (*GetUserInfoResponse, error) AddDeviceToken(context.Context, *AddDeviceTokenRequest) (*UEmpty, error) RemoveDeviceToken(context.Context, *RemoveDeviceTokenRequest) (*UEmpty, error) + UpdateUserNickId(context.Context, *UpdateUserNickIdRequest) (*UEmpty, error) mustEmbedUnimplementedUserServiceServer() } @@ -121,6 +124,9 @@ func (UnimplementedUserServiceServer) AddDeviceToken(context.Context, *AddDevice func (UnimplementedUserServiceServer) RemoveDeviceToken(context.Context, *RemoveDeviceTokenRequest) (*UEmpty, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveDeviceToken not implemented") } +func (UnimplementedUserServiceServer) UpdateUserNickId(context.Context, *UpdateUserNickIdRequest) (*UEmpty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserNickId not implemented") +} func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} // UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. @@ -144,7 +150,7 @@ func _UserService_UpdateUserName_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_UpdateUserName_FullMethodName, + FullMethod: "/UserService/UpdateUserName", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UserServiceServer).UpdateUserName(ctx, req.(*UpdateUserNameRequest)) @@ -162,7 +168,7 @@ func _UserService_UpdateUserAvatar_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_UpdateUserAvatar_FullMethodName, + FullMethod: "/UserService/UpdateUserAvatar", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UserServiceServer).UpdateUserAvatar(ctx, req.(*UpdateUserAvatarRequest)) @@ -180,7 +186,7 @@ func _UserService_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_GetUserInfo_FullMethodName, + FullMethod: "/UserService/GetUserInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UserServiceServer).GetUserInfo(ctx, req.(*GetUserInfoRequest)) @@ -198,7 +204,7 @@ func _UserService_AddDeviceToken_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_AddDeviceToken_FullMethodName, + FullMethod: "/UserService/AddDeviceToken", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UserServiceServer).AddDeviceToken(ctx, req.(*AddDeviceTokenRequest)) @@ -216,7 +222,7 @@ func _UserService_RemoveDeviceToken_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_RemoveDeviceToken_FullMethodName, + FullMethod: "/UserService/RemoveDeviceToken", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UserServiceServer).RemoveDeviceToken(ctx, req.(*RemoveDeviceTokenRequest)) @@ -224,6 +230,24 @@ func _UserService_RemoveDeviceToken_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _UserService_UpdateUserNickId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserNickIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUserNickId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/UserService/UpdateUserNickId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUserNickId(ctx, req.(*UpdateUserNickIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + // UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -251,6 +275,10 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ MethodName: "RemoveDeviceToken", Handler: _UserService_RemoveDeviceToken_Handler, }, + { + MethodName: "UpdateUserNickId", + Handler: _UserService_UpdateUserNickId_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "user.proto", diff --git a/protobuf/gen/monify.swagger.json b/protobuf/gen/monify.swagger.json index 89a6bb1..be2ef99 100644 --- a/protobuf/gen/monify.swagger.json +++ b/protobuf/gen/monify.swagger.json @@ -484,6 +484,37 @@ ] } }, + "/v1/user/nick_id": { + "put": { + "operationId": "UserService_UpdateUserNickId", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/UEmpty" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserNickIdRequest" + } + } + ], + "tags": [ + "UserService" + ], + "security": [ + { + "Bearer": [] + } + ] + } + }, "/v1/groups_bill": { "get": { "operationId": "GroupsBillService_GetGroupBills", @@ -883,6 +914,9 @@ }, "avatarUrl": { "type": "string" + }, + "nickId": { + "type": "string" } } }, @@ -1099,6 +1133,14 @@ "type": "string" } } + }, + "UpdateUserNickIdRequest": { + "type": "object", + "properties": { + "nickId": { + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/protobuf/user.proto b/protobuf/user.proto index 300bf77..f4047a7 100644 --- a/protobuf/user.proto +++ b/protobuf/user.proto @@ -29,6 +29,14 @@ service UserService { } rpc AddDeviceToken (AddDeviceTokenRequest) returns (UEmpty) {} rpc RemoveDeviceToken (RemoveDeviceTokenRequest) returns (UEmpty) {} + + rpc UpdateUserNickId (UpdateUserNickIdRequest) returns (UEmpty){ + option (google.api.http) = { + put: "/v1/user/nick_id" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) ={security: {security_requirement: {key: "Bearer"}}}; + } } message GetUserInfoRequest { @@ -38,6 +46,7 @@ message GetUserInfoRequest { message GetUserInfoResponse { string name = 1; string avatar_url = 2; + string nick_id = 3; } message UpdateUserNameRequest { @@ -54,4 +63,8 @@ message RemoveDeviceTokenRequest { message UpdateUserAvatarRequest { string image_id = 1; +} + +message UpdateUserNickIdRequest { + string nick_id = 1; } \ No newline at end of file diff --git a/services/api/controllers/auth/register.go b/services/api/controllers/auth/register.go index 8f8c223..c2a6fcb 100644 --- a/services/api/controllers/auth/register.go +++ b/services/api/controllers/auth/register.go @@ -3,13 +3,14 @@ package auth import ( "context" "database/sql" + "monify/lib" + monify "monify/protobuf/gen/go" + "github.com/google/uuid" "go.uber.org/zap" "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "monify/lib" - monify "monify/protobuf/gen/go" ) func emailExists(ctx context.Context, email string) (bool, error) { @@ -38,8 +39,8 @@ func CreateUser(ctx context.Context, email string, password string) (uuid.UUID, userId := uuid.New() _, err = db.ExecContext(ctx, ` - INSERT INTO user_identity (user_id) VALUES ($1) - `, userId) + INSERT INTO user_identity (user_id, nick_id) VALUES ($1, $2) + `, userId, userId.String()) if err != nil { return uuid.Nil, err } diff --git a/services/api/controllers/friend/friend_invite.go b/services/api/controllers/friend/friend_invite.go new file mode 100644 index 0000000..da8a7cf --- /dev/null +++ b/services/api/controllers/friend/friend_invite.go @@ -0,0 +1,50 @@ +package friend + +import ( + "context" + "database/sql" + "monify/lib" + monify "monify/protobuf/gen/go" + + "github.com/google/uuid" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s Service) InviteFriend(ctx context.Context, req *monify.InviteFriendRequest) (*monify.InviteFriendResponse, error) { + + logger := ctx.Value(lib.LoggerContextKey{}).(*zap.Logger) + userId := ctx.Value(lib.UserIdContextKey{}).(uuid.UUID) + if userId == uuid.Nil { + return nil, status.Error(codes.Unauthenticated, "Unauthorized.") + } + receiver_nickId := req.GetReceiverNickId() + db := ctx.Value(lib.DatabaseContextKey{}).(*sql.DB) + + query := db.QueryRowContext(ctx, + `SELECT user_id FROM user_identity WHERE nick_id = $1`, receiver_nickId) + + var receiverId string + if err := query.Scan(&receiverId); err != nil { + logger.Error("Scan receiver_id error.", zap.Error(err)) + return nil, status.Error(codes.Internal, "") + } + + if receiverId == userId.String() { + return nil, status.Error(codes.InvalidArgument, "Cannot send invitation to yourself.") + } + + inviteId := uuid.New() + _, err := db.ExecContext(ctx, + `INSERT INTO friend_invite (invite_id, sender, receiver) VALUES ($1, $2, $3)`, + inviteId, userId, receiverId) + if err != nil { + logger.Error("Failed to insert into friend_invite.", zap.Error(err)) + return nil, status.Error(codes.Internal, "") + } + + return &monify.InviteFriendResponse{ + InviteId: inviteId.String(), + }, nil +} diff --git a/services/api/controllers/friend/list_friend_invitation.go b/services/api/controllers/friend/list_friend_invitation.go new file mode 100644 index 0000000..8ff6ba9 --- /dev/null +++ b/services/api/controllers/friend/list_friend_invitation.go @@ -0,0 +1,46 @@ +package friend + +import ( + "context" + "database/sql" + "monify/lib" + monify "monify/protobuf/gen/go" + + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s Service) ListFriendInvitation(ctx context.Context, req *monify.FriendEmpty) (*monify.ListFriendInvitationResponse, error) { + logger := ctx.Value(lib.LoggerContextKey{}).(*zap.Logger) + userId := ctx.Value(lib.UserIdContextKey{}) + if userId == nil { + return nil, status.Error(codes.Unauthenticated, "Unauthorized.") + } + db := ctx.Value(lib.DatabaseContextKey{}).(*sql.DB) + query, err := db.QueryContext(ctx, ` + SELECT nick_id, name + FROM user_identity JOIN friend_invite ON user_identity.user_id = friend_invite.sender + WHERE friend_invite.receiver = $1`, userId) + if err != nil { + logger.Error("Select friend invitation error.", zap.Error(err)) + return nil, status.Error(codes.Internal, "") + } + + var invitaions []*monify.Invitation + for { + if !query.Next() { + break + } + var invitaion monify.Invitation + if err = query.Scan(&invitaion.SenderNickId, &invitaion.SenderName); err != nil { + logger.Error("Scan invitation nick_id and name error.", zap.Error(err)) + return nil, status.Error(codes.Internal, "") + } + invitaions = append(invitaions, &invitaion) + } + + return &monify.ListFriendInvitationResponse{ + Invitation: invitaions, + }, nil +} diff --git a/services/api/controllers/friend/service.go b/services/api/controllers/friend/service.go new file mode 100644 index 0000000..f87cd3c --- /dev/null +++ b/services/api/controllers/friend/service.go @@ -0,0 +1,9 @@ +package friend + +import ( + monify "monify/protobuf/gen/go" +) + +type Service struct { + monify.UnimplementedFriendServiceServer +} diff --git a/services/api/controllers/user/get.go b/services/api/controllers/user/get.go index e3ebfbc..6b11a07 100644 --- a/services/api/controllers/user/get.go +++ b/services/api/controllers/user/get.go @@ -3,13 +3,14 @@ package user import ( "context" "database/sql" + "monify/lib" + monify "monify/protobuf/gen/go" + "monify/services/api/infra" + "github.com/google/uuid" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "monify/lib" - monify "monify/protobuf/gen/go" - "monify/services/api/infra" ) func (Service) GetUserInfo(ctx context.Context, req *monify.GetUserInfoRequest) (*monify.GetUserInfoResponse, error) { @@ -22,10 +23,10 @@ func (Service) GetUserInfo(ctx context.Context, req *monify.GetUserInfoRequest) response := monify.GetUserInfoResponse{} err := db.QueryRowContext(ctx, ` - SELECT name, cf.path + SELECT name, cf.path, nick_id FROM user_identity LEFT JOIN confirmed_file cf on user_identity.avatar_id = cf.file_id - WHERE user_id = $1`, userId).Scan(&response.Name, &response.AvatarUrl) + WHERE user_id = $1`, userId).Scan(&response.Name, &response.AvatarUrl, &response.NickId) if err != nil { if err == sql.ErrNoRows { return nil, status.Error(codes.NotFound, "Not found") diff --git a/services/api/controllers/user/u_name.go b/services/api/controllers/user/u_name.go index dea3aeb..c0d4bd8 100644 --- a/services/api/controllers/user/u_name.go +++ b/services/api/controllers/user/u_name.go @@ -3,11 +3,12 @@ package user import ( "context" "database/sql" + "monify/lib" + monify "monify/protobuf/gen/go" + "github.com/google/uuid" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "monify/lib" - monify "monify/protobuf/gen/go" ) func (s Service) UpdateUserName(ctx context.Context, req *monify.UpdateUserNameRequest) (*monify.UEmpty, error) { diff --git a/services/api/controllers/user/u_nickId.go b/services/api/controllers/user/u_nickId.go new file mode 100644 index 0000000..38b55f3 --- /dev/null +++ b/services/api/controllers/user/u_nickId.go @@ -0,0 +1,29 @@ +package user + +import ( + "context" + "database/sql" + "monify/lib" + monify "monify/protobuf/gen/go" + + "github.com/google/uuid" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s Service) UpdateUserNickId(ctx context.Context, req *monify.UpdateUserNickIdRequest) (*monify.UEmpty, error) { + logger := ctx.Value(lib.LoggerContextKey{}).(*zap.Logger) + userId, ok := ctx.Value(lib.UserIdContextKey{}).(uuid.UUID) + if !ok { + return nil, status.Error(codes.Unauthenticated, "Unauthorized") + } + + db := ctx.Value(lib.DatabaseContextKey{}).(*sql.DB) + _, err := db.ExecContext(ctx, "UPDATE user_identity SET nick_id = $1 WHERE user_id = $2", req.NickId, userId) + if err != nil { + logger.Error("Update nick_id error.", zap.Error(err)) + return nil, status.Error(codes.Internal, "Internal") + } + return &monify.UEmpty{}, nil +} diff --git a/services/api/server.go b/services/api/server.go index ea7e109..ee26835 100644 --- a/services/api/server.go +++ b/services/api/server.go @@ -4,21 +4,23 @@ import ( "context" "errors" "fmt" - "github.com/google/uuid" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "monify/lib" authLib "monify/lib/auth" monify "monify/protobuf/gen/go" "monify/services/api/controllers/auth" + "monify/services/api/controllers/friend" "monify/services/api/controllers/group" "monify/services/api/controllers/group_bill" "monify/services/api/controllers/user" "monify/services/api/infra" "net" "time" + + "github.com/google/uuid" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) type Server struct { @@ -48,6 +50,7 @@ func SetupServices(g *grpc.Server, config ServerConfig) { monify.RegisterGroupServiceServer(g, group.Service{}) monify.RegisterGroupsBillServiceServer(g, group_bill.Service{}) monify.RegisterUserServiceServer(g, user.Service{}) + monify.RegisterFriendServiceServer(g, friend.Service{}) } func setupInterceptor(resources infra.Resources, config ServerConfig) grpc.ServerOption { diff --git a/services/api/test/friend_invite_test.go b/services/api/test/friend_invite_test.go new file mode 100644 index 0000000..d4ae349 --- /dev/null +++ b/services/api/test/friend_invite_test.go @@ -0,0 +1,31 @@ +package test + +import ( + "context" + monify "monify/protobuf/gen/go" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestInviteFriend(t *testing.T) { + // test invite + client := GetTestClient(t) + user1 := client.CreateTestUser() + _, err := client.UpdateUserNickId(context.Background(), &monify.UpdateUserNickIdRequest{NickId: "test_nickId1"}) + assert.NoError(t, err) + _, err = client.InviteFriend(context.TODO(), &monify.InviteFriendRequest{ReceiverNickId: "test_nickId1"}) + assert.Error(t, err) // cannot send invitation to yourself + _ = client.CreateTestUser() + _, err = client.InviteFriend(context.TODO(), &monify.InviteFriendRequest{ReceiverNickId: "test_nickId1"}) + assert.NoError(t, err) + _ = client.CreateTestUser() + _, err = client.InviteFriend(context.TODO(), &monify.InviteFriendRequest{ReceiverNickId: "test_nickId1"}) + assert.NoError(t, err) + + // test list invitation + client.SetTestUser(user1) + invitaions, err := client.ListFriendInvitation(context.TODO(), &monify.FriendEmpty{}) + assert.NoError(t, err) + assert.Equal(t, len(invitaions.GetInvitation()), 2) +} diff --git a/services/api/test/server.go b/services/api/test/server.go index f918b7f..6cc67ea 100644 --- a/services/api/test/server.go +++ b/services/api/test/server.go @@ -2,12 +2,6 @@ package test import ( "context" - "github.com/google/uuid" - "github.com/joho/godotenv" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/test/bufconn" "log" "monify/lib/utils" monify "monify/protobuf/gen/go" @@ -15,6 +9,13 @@ import ( "net" "sync" "testing" + + "github.com/google/uuid" + "github.com/joho/godotenv" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/test/bufconn" ) type State struct { @@ -29,6 +30,7 @@ type Client struct { monify.GroupServiceClient monify.GroupsBillServiceClient monify.UserServiceClient + monify.FriendServiceClient users *map[string]string currentUser *string } @@ -108,6 +110,7 @@ func createClient(lis *bufconn.Listener) Client { GroupServiceClient: monify.NewGroupServiceClient(conn), GroupsBillServiceClient: monify.NewGroupsBillServiceClient(conn), UserServiceClient: monify.NewUserServiceClient(conn), + FriendServiceClient: monify.NewFriendServiceClient(conn), users: &users, currentUser: ¤tUser, } diff --git a/services/api/test/user_test.go b/services/api/test/user_test.go index d919a04..248f75a 100644 --- a/services/api/test/user_test.go +++ b/services/api/test/user_test.go @@ -2,20 +2,24 @@ package test import ( "context" - "github.com/stretchr/testify/assert" monify "monify/protobuf/gen/go" "testing" + + "github.com/stretchr/testify/assert" ) -func TestChangeUsername(t *testing.T) { +func TestChangeUsernameAndUsernickId(t *testing.T) { client := GetTestClient(t) userId := client.CreateTestUser() - ctx := context.Background() - _, err := client.UpdateUserName(ctx, &monify.UpdateUserNameRequest{Name: "testname"}) + _, err := client.UpdateUserName(context.Background(), &monify.UpdateUserNameRequest{Name: "testname"}) + assert.NoError(t, err) + + _, err = client.UpdateUserNickId(context.Background(), &monify.UpdateUserNickIdRequest{NickId: "test_update_nickId"}) assert.NoError(t, err) - info, err := client.GetUserInfo(ctx, &monify.GetUserInfoRequest{UserId: userId}) + info, err := client.GetUserInfo(context.Background(), &monify.GetUserInfoRequest{UserId: userId}) assert.NoError(t, err) assert.Equal(t, "testname", info.Name) + assert.Equal(t, "test_update_nickId", info.NickId) }