v1

package
v0.0.0-...-c1a7e98 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserCenter_Authorize_FullMethodName = "/usercenter.v1.UserCenter/Authorize"
)

Variables

View Source
var File_api_usercenter_v1_usercenter_proto protoreflect.FileDescriptor
View Source
var UserCenter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "usercenter.v1.UserCenter",
	HandlerType: (*UserCenterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Authorize",
			Handler:    _UserCenter_Authorize_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/usercenter/v1/usercenter.proto",
}

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

Functions

func RegisterUserCenterServer

func RegisterUserCenterServer(s grpc.ServiceRegistrar, srv UserCenterServer)

Types

type AuthzRequest

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

func (*AuthzRequest) Descriptor deprecated

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

Deprecated: Use AuthzRequest.ProtoReflect.Descriptor instead.

func (*AuthzRequest) GetPassword

func (x *AuthzRequest) GetPassword() string

func (*AuthzRequest) GetToken

func (x *AuthzRequest) GetToken() string

func (*AuthzRequest) ProtoMessage

func (*AuthzRequest) ProtoMessage()

func (*AuthzRequest) ProtoReflect

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

func (*AuthzRequest) Reset

func (x *AuthzRequest) Reset()

func (*AuthzRequest) String

func (x *AuthzRequest) String() string

type AuthzResponse

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

func (*AuthzResponse) Descriptor deprecated

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

Deprecated: Use AuthzResponse.ProtoReflect.Descriptor instead.

func (*AuthzResponse) GetUserId

func (x *AuthzResponse) GetUserId() string

func (*AuthzResponse) ProtoMessage

func (*AuthzResponse) ProtoMessage()

func (*AuthzResponse) ProtoReflect

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

func (*AuthzResponse) Reset

func (x *AuthzResponse) Reset()

func (*AuthzResponse) String

func (x *AuthzResponse) String() string

type ChangePasswordRequest

type ChangePasswordRequest struct {

	// 旧密码.
	OldPassword string `json:"oldPassword" valid:"required,stringlength(6|18)"`

	// 新密码.
	NewPassword string `json:"newPassword" valid:"required,stringlength(6|18)"`
}

ChangePasswordRequest 指定了 `POST /v1/users/{name}/change-password` 接口的请求参数.

type CreateUserRequest

type CreateUserRequest struct {
	Username string `json:"username" valid:"alphanum,required,stringlength(1|255)"`
	Password string `json:"password" valid:"required,stringlength(6|18)"`
	Nickname string `json:"nickname" valid:"required,stringlength(1|255)"`
	Email    string `json:"email" valid:"required,email"`
	Phone    string `json:"phone" valid:"required,stringlength(11|11)"`
}

CreateUserRequest 指定了 `POST /v1/users` 接口的请求参数.

type CreateUserResponse

type CreateUserResponse struct {
	UserID int64 `json:"userId"`
}

type DeleteUserRequest

type DeleteUserRequest struct {
	Username int64 `json:"username"`
}

type GetUserRequest

type GetUserRequest struct {
	Token    string `json:"token"`
	Username string `json:"username"`
}

type GetUserResponse

type GetUserResponse UserInfo

GetUserResponse 指定了 `GET /v1/users/{name}` 接口的返回参数.

type ListUserRequest

type ListUserRequest struct {
	Offset int64 `form:"offset"`
	Limit  int64 `form:"limit"`
}

type ListUserResponse

type ListUserResponse struct {
	TotalCount int64       `json:"totalCount"`
	Users      []*UserInfo `json:"users"`
}

ListUserResponse 指定了 `GET /v1/users` 接口的返回参数.

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" valid:"alphanum,required,stringlength(1|255)"`
	Password string `json:"password" valid:"required,stringlength(6|18)"`
}

LoginRequest 指定了 `POST /login` 接口的请求参数.

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

LoginResponse 指定了 `POST /login` 接口的返回参数.

type UnimplementedUserCenterServer

type UnimplementedUserCenterServer struct {
}

UnimplementedUserCenterServer must be embedded to have forward compatible implementations.

func (UnimplementedUserCenterServer) Authorize

type UnsafeUserCenterServer

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

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

type UpdateUserRequest

type UpdateUserRequest struct {
	// 带星号表示可选类型
	// 不带表示必填字段
	Username string  `json:"username" valid:"stringlength(1|255)"`
	Nickname *string `json:"nickname" valid:"stringlength(1|255)"`
	Email    *string `json:"email" valid:"email"`
	Phone    *string `json:"phone" valid:"stringlength(11|11)"`
}

UpdateUserRequest 指定了 `PUT /v1/users/{name}` 接口的请求参数.

type UserCenterClient

type UserCenterClient interface {
	Authorize(ctx context.Context, in *AuthzRequest, opts ...grpc.CallOption) (*AuthzResponse, error)
}

UserCenterClient is the client API for UserCenter 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 NewUserCenterClient

func NewUserCenterClient(cc grpc.ClientConnInterface) UserCenterClient

type UserCenterServer

type UserCenterServer interface {
	Authorize(context.Context, *AuthzRequest) (*AuthzResponse, error)
	// contains filtered or unexported methods
}

UserCenterServer is the server API for UserCenter service. All implementations must embed UnimplementedUserCenterServer for forward compatibility

type UserInfo

type UserInfo struct {
	Username  string `json:"username"`
	Nickname  string `json:"nickname"`
	Email     string `json:"email"`
	Phone     string `json:"phone"`
	PostCount int64  `json:"postCount"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

UserInfo 指定了用户的详细信息.

Jump to

Keyboard shortcuts

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