v1

package
v0.0.0-...-c2164b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Greeter_Register_FullMethodName       = "/auth.v1.Greeter/Register"
	Greeter_Login_FullMethodName          = "/auth.v1.Greeter/Login"
	Greeter_GetIdByToken_FullMethodName   = "/auth.v1.Greeter/GetIdByToken"
	Greeter_UpdateUserInfo_FullMethodName = "/auth.v1.Greeter/UpdateUserInfo"
)
View Source
const OperationGreeterGetIdByToken = "/auth.v1.Greeter/GetIdByToken"
View Source
const OperationGreeterLogin = "/auth.v1.Greeter/Login"
View Source
const OperationGreeterRegister = "/auth.v1.Greeter/Register"
View Source
const OperationGreeterUpdateUserInfo = "/auth.v1.Greeter/UpdateUserInfo"

Variables

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "GREETER_UNSPECIFIED",
		1: "USER_NOT_FOUND",
		2: "USER_AUTH_ERROR",
		3: "Internal_Error",
	}
	ErrorReason_value = map[string]int32{
		"GREETER_UNSPECIFIED": 0,
		"USER_NOT_FOUND":      1,
		"USER_AUTH_ERROR":     2,
		"Internal_Error":      3,
	}
)

Enum value maps for ErrorReason.

View Source
var File_auth_v1_auth_proto protoreflect.FileDescriptor
View Source
var File_auth_v1_error_reason_proto protoreflect.FileDescriptor
View Source
var Greeter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "auth.v1.Greeter",
	HandlerType: (*GreeterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Register",
			Handler:    _Greeter_Register_Handler,
		},
		{
			MethodName: "Login",
			Handler:    _Greeter_Login_Handler,
		},
		{
			MethodName: "GetIdByToken",
			Handler:    _Greeter_GetIdByToken_Handler,
		},
		{
			MethodName: "UpdateUserInfo",
			Handler:    _Greeter_UpdateUserInfo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "auth/v1/auth.proto",
}

Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func ErrorUserNotFound

func ErrorUserNotFound(format string, args ...interface{}) *errors.Error

func InternalError

func InternalError(format string, args ...interface{}) *errors.Error

func IsInternalError

func IsInternalError(err error) bool

func IsUserAuthError

func IsUserAuthError(err error) bool

func IsUserNotFound

func IsUserNotFound(err error) bool

func RegisterGreeterHTTPServer

func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer)

func RegisterGreeterServer

func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)

func UserAuthError

func UserAuthError(format string, args ...interface{}) *errors.Error

Types

type AuthReply

type AuthReply struct {
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthReply) Descriptor deprecated

func (*AuthReply) Descriptor() ([]byte, []int)

Deprecated: Use AuthReply.ProtoReflect.Descriptor instead.

func (*AuthReply) GetToken

func (x *AuthReply) GetToken() string

func (*AuthReply) ProtoMessage

func (*AuthReply) ProtoMessage()

func (*AuthReply) ProtoReflect

func (x *AuthReply) ProtoReflect() protoreflect.Message

func (*AuthReply) Reset

func (x *AuthReply) Reset()

func (*AuthReply) String

func (x *AuthReply) String() string

type AuthRequest

type AuthRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthRequest) Descriptor deprecated

func (*AuthRequest) Descriptor() ([]byte, []int)

Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.

func (*AuthRequest) GetPassword

func (x *AuthRequest) GetPassword() string

func (*AuthRequest) GetUsername

func (x *AuthRequest) GetUsername() string

func (*AuthRequest) ProtoMessage

func (*AuthRequest) ProtoMessage()

func (*AuthRequest) ProtoReflect

func (x *AuthRequest) ProtoReflect() protoreflect.Message

func (*AuthRequest) Reset

func (x *AuthRequest) Reset()

func (*AuthRequest) String

func (x *AuthRequest) String() string

type ErrorReason

type ErrorReason int32
const (
	ErrorReason_GREETER_UNSPECIFIED ErrorReason = 0
	ErrorReason_USER_NOT_FOUND      ErrorReason = 1
	ErrorReason_USER_AUTH_ERROR     ErrorReason = 2
	ErrorReason_Internal_Error      ErrorReason = 3
)

func (ErrorReason) Descriptor

func (ErrorReason) Enum

func (x ErrorReason) Enum() *ErrorReason

func (ErrorReason) EnumDescriptor deprecated

func (ErrorReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorReason.Descriptor instead.

func (ErrorReason) Number

func (x ErrorReason) Number() protoreflect.EnumNumber

func (ErrorReason) String

func (x ErrorReason) String() string

func (ErrorReason) Type

type GetIdByTokenReply

type GetIdByTokenReply struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetIdByTokenReply) Descriptor deprecated

func (*GetIdByTokenReply) Descriptor() ([]byte, []int)

Deprecated: Use GetIdByTokenReply.ProtoReflect.Descriptor instead.

func (*GetIdByTokenReply) GetId

func (x *GetIdByTokenReply) GetId() int64

func (*GetIdByTokenReply) ProtoMessage

func (*GetIdByTokenReply) ProtoMessage()

func (*GetIdByTokenReply) ProtoReflect

func (x *GetIdByTokenReply) ProtoReflect() protoreflect.Message

func (*GetIdByTokenReply) Reset

func (x *GetIdByTokenReply) Reset()

func (*GetIdByTokenReply) String

func (x *GetIdByTokenReply) String() string

type GetIdByTokenReq

type GetIdByTokenReq struct {
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*GetIdByTokenReq) Descriptor deprecated

func (*GetIdByTokenReq) Descriptor() ([]byte, []int)

Deprecated: Use GetIdByTokenReq.ProtoReflect.Descriptor instead.

func (*GetIdByTokenReq) GetToken

func (x *GetIdByTokenReq) GetToken() string

func (*GetIdByTokenReq) ProtoMessage

func (*GetIdByTokenReq) ProtoMessage()

func (*GetIdByTokenReq) ProtoReflect

func (x *GetIdByTokenReq) ProtoReflect() protoreflect.Message

func (*GetIdByTokenReq) Reset

func (x *GetIdByTokenReq) Reset()

func (*GetIdByTokenReq) String

func (x *GetIdByTokenReq) String() string

type GreeterClient

type GreeterClient interface {
	// Sends a greeting
	Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	Login(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error)
	GetIdByToken(ctx context.Context, in *GetIdByTokenReq, opts ...grpc.CallOption) (*GetIdByTokenReply, error)
	UpdateUserInfo(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

GreeterClient is the client API for Greeter 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.

func NewGreeterClient

func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient

type GreeterHTTPClient

type GreeterHTTPClient interface {
	GetIdByToken(ctx context.Context, req *GetIdByTokenReq, opts ...http.CallOption) (rsp *GetIdByTokenReply, err error)
	Login(ctx context.Context, req *AuthRequest, opts ...http.CallOption) (rsp *AuthReply, err error)
	Register(ctx context.Context, req *RegisterRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
	UpdateUserInfo(ctx context.Context, req *UpdateUserReq, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
}

func NewGreeterHTTPClient

func NewGreeterHTTPClient(client *http.Client) GreeterHTTPClient

type GreeterHTTPClientImpl

type GreeterHTTPClientImpl struct {
	// contains filtered or unexported fields
}

func (*GreeterHTTPClientImpl) GetIdByToken

func (*GreeterHTTPClientImpl) Login

func (*GreeterHTTPClientImpl) Register

func (*GreeterHTTPClientImpl) UpdateUserInfo

func (c *GreeterHTTPClientImpl) UpdateUserInfo(ctx context.Context, in *UpdateUserReq, opts ...http.CallOption) (*emptypb.Empty, error)

type GreeterHTTPServer

type GreeterHTTPServer interface {
	GetIdByToken(context.Context, *GetIdByTokenReq) (*GetIdByTokenReply, error)
	Login(context.Context, *AuthRequest) (*AuthReply, error)
	// Register Sends a greeting
	Register(context.Context, *RegisterRequest) (*emptypb.Empty, error)
	UpdateUserInfo(context.Context, *UpdateUserReq) (*emptypb.Empty, error)
}

type GreeterServer

type GreeterServer interface {
	// Sends a greeting
	Register(context.Context, *RegisterRequest) (*emptypb.Empty, error)
	Login(context.Context, *AuthRequest) (*AuthReply, error)
	GetIdByToken(context.Context, *GetIdByTokenReq) (*GetIdByTokenReply, error)
	UpdateUserInfo(context.Context, *UpdateUserReq) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility

type RegisterRequest

type RegisterRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Email    string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Avatar   string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterRequest) Descriptor deprecated

func (*RegisterRequest) Descriptor() ([]byte, []int)

Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.

func (*RegisterRequest) GetAvatar

func (x *RegisterRequest) GetAvatar() string

func (*RegisterRequest) GetEmail

func (x *RegisterRequest) GetEmail() string

func (*RegisterRequest) GetPassword

func (x *RegisterRequest) GetPassword() string

func (*RegisterRequest) GetUsername

func (x *RegisterRequest) GetUsername() string

func (*RegisterRequest) ProtoMessage

func (*RegisterRequest) ProtoMessage()

func (*RegisterRequest) ProtoReflect

func (x *RegisterRequest) ProtoReflect() protoreflect.Message

func (*RegisterRequest) Reset

func (x *RegisterRequest) Reset()

func (*RegisterRequest) String

func (x *RegisterRequest) String() string

type UnimplementedGreeterServer

type UnimplementedGreeterServer struct {
}

UnimplementedGreeterServer must be embedded to have forward compatible implementations.

func (UnimplementedGreeterServer) GetIdByToken

func (UnimplementedGreeterServer) Login

func (UnimplementedGreeterServer) Register

func (UnimplementedGreeterServer) UpdateUserInfo

type UnsafeGreeterServer

type UnsafeGreeterServer interface {
	// contains filtered or unexported methods
}

UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GreeterServer will result in compilation errors.

type UpdateUserReq

type UpdateUserReq struct {
	Id     int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Avatar string `protobuf:"bytes,2,opt,name=avatar,proto3" json:"avatar,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateUserReq) Descriptor deprecated

func (*UpdateUserReq) Descriptor() ([]byte, []int)

Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead.

func (*UpdateUserReq) GetAvatar

func (x *UpdateUserReq) GetAvatar() string

func (*UpdateUserReq) GetId

func (x *UpdateUserReq) GetId() int64

func (*UpdateUserReq) ProtoMessage

func (*UpdateUserReq) ProtoMessage()

func (*UpdateUserReq) ProtoReflect

func (x *UpdateUserReq) ProtoReflect() protoreflect.Message

func (*UpdateUserReq) Reset

func (x *UpdateUserReq) Reset()

func (*UpdateUserReq) String

func (x *UpdateUserReq) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL