Documentation ¶
Index ¶
- func ConvertUserSettingFromStore(userSetting *store.UserSetting) *apiv2pb.UserSetting
- func GenerateAccessToken(username string, userID int, secret string) (string, error)
- func IsAuthenticationAllowed(fullMethodName string) bool
- type APIV2Service
- type ContextKey
- type GRPCAuthInterceptor
- type MemoService
- type SystemService
- type TagService
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertUserSettingFromStore ¶
func ConvertUserSettingFromStore(userSetting *store.UserSetting) *apiv2pb.UserSetting
ConvertUserSettingFromStore converts a user setting from store to protobuf.
func GenerateAccessToken ¶
GenerateAccessToken generates an access token for web.
func IsAuthenticationAllowed ¶
IsAuthenticationAllowed returns whether the method is exempted from authentication.
Types ¶
type APIV2Service ¶
type APIV2Service struct { Secret string Profile *profile.Profile Store *store.Store // contains filtered or unexported fields }
func NewAPIV2Service ¶
func (*APIV2Service) GetGRPCServer ¶
func (s *APIV2Service) GetGRPCServer() *grpc.Server
func (*APIV2Service) RegisterGateway ¶
func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error
RegisterGateway registers the gRPC-Gateway with the given Echo instance.
type ContextKey ¶
type ContextKey int
ContextKey is the key type of context value.
const ( // The key name used to store user id in the context // user id is extracted from the jwt token subject field. UserIDContextKey ContextKey = iota )
type GRPCAuthInterceptor ¶
type GRPCAuthInterceptor struct {
// contains filtered or unexported fields
}
GRPCAuthInterceptor is the auth interceptor for gRPC server.
func NewGRPCAuthInterceptor ¶
func NewGRPCAuthInterceptor(store *store.Store, secret string) *GRPCAuthInterceptor
NewGRPCAuthInterceptor returns a new API auth interceptor.
func (*GRPCAuthInterceptor) AuthenticationInterceptor ¶
func (in *GRPCAuthInterceptor) AuthenticationInterceptor(ctx context.Context, request any, serverInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
AuthenticationInterceptor is the unary interceptor for gRPC API.
type MemoService ¶
type MemoService struct { apiv2pb.UnimplementedMemoServiceServer Store *store.Store }
func NewMemoService ¶
func NewMemoService(store *store.Store) *MemoService
NewMemoService creates a new MemoService.
func (*MemoService) GetMemo ¶
func (s *MemoService) GetMemo(ctx context.Context, request *apiv2pb.GetMemoRequest) (*apiv2pb.GetMemoResponse, error)
func (*MemoService) ListMemos ¶
func (s *MemoService) ListMemos(ctx context.Context, request *apiv2pb.ListMemosRequest) (*apiv2pb.ListMemosResponse, error)
type SystemService ¶
type SystemService struct { apiv2pb.UnimplementedSystemServiceServer Profile *profile.Profile Store *store.Store }
func NewSystemService ¶
func NewSystemService(profile *profile.Profile, store *store.Store) *SystemService
NewSystemService creates a new SystemService.
func (*SystemService) GetSystemInfo ¶
func (s *SystemService) GetSystemInfo(ctx context.Context, _ *apiv2pb.GetSystemInfoRequest) (*apiv2pb.GetSystemInfoResponse, error)
type TagService ¶
type TagService struct { apiv2pb.UnimplementedTagServiceServer Store *store.Store }
func NewTagService ¶
func NewTagService(store *store.Store) *TagService
NewTagService creates a new TagService.
func (*TagService) ListTags ¶
func (s *TagService) ListTags(ctx context.Context, request *apiv2pb.ListTagsRequest) (*apiv2pb.ListTagsResponse, error)
type UserService ¶
type UserService struct { apiv2pb.UnimplementedUserServiceServer Store *store.Store }
func NewUserService ¶
func NewUserService(store *store.Store) *UserService
NewUserService creates a new UserService.
func (*UserService) GetUser ¶
func (s *UserService) GetUser(ctx context.Context, request *apiv2pb.GetUserRequest) (*apiv2pb.GetUserResponse, error)