New list user friends & blocklist calls

This commit is contained in:
2024-07-30 18:31:26 +08:00
parent 82305206b0
commit 4cea915abf
15 changed files with 572 additions and 183 deletions

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc-gen-go-grpc v1.4.0
// - protoc v5.27.1
// source: auth.proto
@ -15,8 +15,16 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.62.0 or later.
const _ = grpc.SupportPackageIsVersion8
const (
Auth_Authenticate_FullMethodName = "/proto.Auth/Authenticate"
Auth_EnsurePermGranted_FullMethodName = "/proto.Auth/EnsurePermGranted"
Auth_EnsureUserPermGranted_FullMethodName = "/proto.Auth/EnsureUserPermGranted"
Auth_ListUserFriends_FullMethodName = "/proto.Auth/ListUserFriends"
Auth_ListUserBlocklist_FullMethodName = "/proto.Auth/ListUserBlocklist"
)
// AuthClient is the client API for Auth service.
//
@ -25,6 +33,8 @@ type AuthClient interface {
Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error)
EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error)
EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error)
ListUserFriends(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error)
ListUserBlocklist(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error)
}
type authClient struct {
@ -36,8 +46,9 @@ func NewAuthClient(cc grpc.ClientConnInterface) AuthClient {
}
func (c *authClient) Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AuthReply)
err := c.cc.Invoke(ctx, "/proto.Auth/Authenticate", in, out, opts...)
err := c.cc.Invoke(ctx, Auth_Authenticate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -45,8 +56,9 @@ func (c *authClient) Authenticate(ctx context.Context, in *AuthRequest, opts ...
}
func (c *authClient) EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckPermResponse)
err := c.cc.Invoke(ctx, "/proto.Auth/EnsurePermGranted", in, out, opts...)
err := c.cc.Invoke(ctx, Auth_EnsurePermGranted_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -54,8 +66,29 @@ func (c *authClient) EnsurePermGranted(ctx context.Context, in *CheckPermRequest
}
func (c *authClient) EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckUserPermResponse)
err := c.cc.Invoke(ctx, "/proto.Auth/EnsureUserPermGranted", in, out, opts...)
err := c.cc.Invoke(ctx, Auth_EnsureUserPermGranted_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) ListUserFriends(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListUserRelativeResponse)
err := c.cc.Invoke(ctx, Auth_ListUserFriends_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) ListUserBlocklist(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListUserRelativeResponse)
err := c.cc.Invoke(ctx, Auth_ListUserBlocklist_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -69,6 +102,8 @@ type AuthServer interface {
Authenticate(context.Context, *AuthRequest) (*AuthReply, error)
EnsurePermGranted(context.Context, *CheckPermRequest) (*CheckPermResponse, error)
EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error)
ListUserFriends(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error)
ListUserBlocklist(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error)
mustEmbedUnimplementedAuthServer()
}
@ -85,6 +120,12 @@ func (UnimplementedAuthServer) EnsurePermGranted(context.Context, *CheckPermRequ
func (UnimplementedAuthServer) EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method EnsureUserPermGranted not implemented")
}
func (UnimplementedAuthServer) ListUserFriends(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUserFriends not implemented")
}
func (UnimplementedAuthServer) ListUserBlocklist(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUserBlocklist not implemented")
}
func (UnimplementedAuthServer) mustEmbedUnimplementedAuthServer() {}
// UnsafeAuthServer may be embedded to opt out of forward compatibility for this service.
@ -108,7 +149,7 @@ func _Auth_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Auth/Authenticate",
FullMethod: Auth_Authenticate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).Authenticate(ctx, req.(*AuthRequest))
@ -126,7 +167,7 @@ func _Auth_EnsurePermGranted_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Auth/EnsurePermGranted",
FullMethod: Auth_EnsurePermGranted_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).EnsurePermGranted(ctx, req.(*CheckPermRequest))
@ -144,7 +185,7 @@ func _Auth_EnsureUserPermGranted_Handler(srv interface{}, ctx context.Context, d
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Auth/EnsureUserPermGranted",
FullMethod: Auth_EnsureUserPermGranted_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).EnsureUserPermGranted(ctx, req.(*CheckUserPermRequest))
@ -152,6 +193,42 @@ func _Auth_EnsureUserPermGranted_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _Auth_ListUserFriends_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUserRelativeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).ListUserFriends(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_ListUserFriends_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).ListUserFriends(ctx, req.(*ListUserRelativeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_ListUserBlocklist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUserRelativeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).ListUserBlocklist(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_ListUserBlocklist_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).ListUserBlocklist(ctx, req.(*ListUserRelativeRequest))
}
return interceptor(ctx, in, info, handler)
}
// Auth_ServiceDesc is the grpc.ServiceDesc for Auth service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -171,6 +248,14 @@ var Auth_ServiceDesc = grpc.ServiceDesc{
MethodName: "EnsureUserPermGranted",
Handler: _Auth_EnsureUserPermGranted_Handler,
},
{
MethodName: "ListUserFriends",
Handler: _Auth_ListUserFriends_Handler,
},
{
MethodName: "ListUserBlocklist",
Handler: _Auth_ListUserBlocklist_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth.proto",