You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
216 lines
6.8 KiB
Go
216 lines
6.8 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: authpb.proto
|
|
|
|
package authpb
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "google.golang.org/protobuf/proto"
|
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
math "math"
|
|
)
|
|
|
|
import (
|
|
context "context"
|
|
api "go-micro.dev/v4/api"
|
|
client "go-micro.dev/v4/client"
|
|
server "go-micro.dev/v4/server"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ api.Endpoint
|
|
var _ context.Context
|
|
var _ client.Option
|
|
var _ server.Option
|
|
|
|
// Api Endpoints for AuthService service
|
|
|
|
func NewAuthServiceEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for AuthService service
|
|
|
|
type AuthService interface {
|
|
// *
|
|
// @auth AdminAndService
|
|
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*UserListReply, error)
|
|
// *
|
|
// @auth AuthenticatedUsers
|
|
Detail(ctx context.Context, in *UserIDRequest, opts ...client.CallOption) (*User, error)
|
|
Delete(ctx context.Context, in *UserIDRequest, opts ...client.CallOption) (*emptypb.Empty, error)
|
|
UpdateRoles(ctx context.Context, in *UpdateRolesRequest, opts ...client.CallOption) (*User, error)
|
|
Register(ctx context.Context, in *RegisterRequest, opts ...client.CallOption) (*User, error)
|
|
Login(ctx context.Context, in *LoginRequest, opts ...client.CallOption) (*TokenReply, error)
|
|
Refresh(ctx context.Context, in *RefreshTokenRequest, opts ...client.CallOption) (*TokenReply, error)
|
|
Inspect(ctx context.Context, in *TokenRequest, opts ...client.CallOption) (*User, error)
|
|
}
|
|
|
|
type authService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewAuthService(name string, c client.Client) AuthService {
|
|
return &authService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *authService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*UserListReply, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.List", in)
|
|
out := new(UserListReply)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) Detail(ctx context.Context, in *UserIDRequest, opts ...client.CallOption) (*User, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.Detail", in)
|
|
out := new(User)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) Delete(ctx context.Context, in *UserIDRequest, opts ...client.CallOption) (*emptypb.Empty, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.Delete", in)
|
|
out := new(emptypb.Empty)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) UpdateRoles(ctx context.Context, in *UpdateRolesRequest, opts ...client.CallOption) (*User, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.UpdateRoles", in)
|
|
out := new(User)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) Register(ctx context.Context, in *RegisterRequest, opts ...client.CallOption) (*User, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.Register", in)
|
|
out := new(User)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) Login(ctx context.Context, in *LoginRequest, opts ...client.CallOption) (*TokenReply, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.Login", in)
|
|
out := new(TokenReply)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) Refresh(ctx context.Context, in *RefreshTokenRequest, opts ...client.CallOption) (*TokenReply, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.Refresh", in)
|
|
out := new(TokenReply)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *authService) Inspect(ctx context.Context, in *TokenRequest, opts ...client.CallOption) (*User, error) {
|
|
req := c.c.NewRequest(c.name, "AuthService.Inspect", in)
|
|
out := new(User)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for AuthService service
|
|
|
|
type AuthServiceHandler interface {
|
|
// *
|
|
// @auth AdminAndService
|
|
List(context.Context, *ListRequest, *UserListReply) error
|
|
// *
|
|
// @auth AuthenticatedUsers
|
|
Detail(context.Context, *UserIDRequest, *User) error
|
|
Delete(context.Context, *UserIDRequest, *emptypb.Empty) error
|
|
UpdateRoles(context.Context, *UpdateRolesRequest, *User) error
|
|
Register(context.Context, *RegisterRequest, *User) error
|
|
Login(context.Context, *LoginRequest, *TokenReply) error
|
|
Refresh(context.Context, *RefreshTokenRequest, *TokenReply) error
|
|
Inspect(context.Context, *TokenRequest, *User) error
|
|
}
|
|
|
|
func RegisterAuthServiceHandler(s server.Server, hdlr AuthServiceHandler, opts ...server.HandlerOption) error {
|
|
type authService interface {
|
|
List(ctx context.Context, in *ListRequest, out *UserListReply) error
|
|
Detail(ctx context.Context, in *UserIDRequest, out *User) error
|
|
Delete(ctx context.Context, in *UserIDRequest, out *emptypb.Empty) error
|
|
UpdateRoles(ctx context.Context, in *UpdateRolesRequest, out *User) error
|
|
Register(ctx context.Context, in *RegisterRequest, out *User) error
|
|
Login(ctx context.Context, in *LoginRequest, out *TokenReply) error
|
|
Refresh(ctx context.Context, in *RefreshTokenRequest, out *TokenReply) error
|
|
Inspect(ctx context.Context, in *TokenRequest, out *User) error
|
|
}
|
|
type AuthService struct {
|
|
authService
|
|
}
|
|
h := &authServiceHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&AuthService{h}, opts...))
|
|
}
|
|
|
|
type authServiceHandler struct {
|
|
AuthServiceHandler
|
|
}
|
|
|
|
func (h *authServiceHandler) List(ctx context.Context, in *ListRequest, out *UserListReply) error {
|
|
return h.AuthServiceHandler.List(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) Detail(ctx context.Context, in *UserIDRequest, out *User) error {
|
|
return h.AuthServiceHandler.Detail(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) Delete(ctx context.Context, in *UserIDRequest, out *emptypb.Empty) error {
|
|
return h.AuthServiceHandler.Delete(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) UpdateRoles(ctx context.Context, in *UpdateRolesRequest, out *User) error {
|
|
return h.AuthServiceHandler.UpdateRoles(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) Register(ctx context.Context, in *RegisterRequest, out *User) error {
|
|
return h.AuthServiceHandler.Register(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) Login(ctx context.Context, in *LoginRequest, out *TokenReply) error {
|
|
return h.AuthServiceHandler.Login(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) Refresh(ctx context.Context, in *RefreshTokenRequest, out *TokenReply) error {
|
|
return h.AuthServiceHandler.Refresh(ctx, in, out)
|
|
}
|
|
|
|
func (h *authServiceHandler) Inspect(ctx context.Context, in *TokenRequest, out *User) error {
|
|
return h.AuthServiceHandler.Inspect(ctx, in, out)
|
|
}
|