dto

package
v0.0.0-...-5e02c43 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddFriendResult

type AddFriendResult struct {
	FriendRequest *FriendRequest `json:"friendRequest"`
	Status        int32          `json:"status"`
}

func AddFriendResultFromPb

func AddFriendResultFromPb(pb *friendv1.AddFriendResult) *AddFriendResult

type BaseFriendRequest

type BaseFriendRequest struct {
	UID       types.ID `json:"-"` // no validation
	FriendUID types.ID `json:"friendUid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
}

func (*BaseFriendRequest) ToPb

type ChangeGroupMemberRequest

type ChangeGroupMemberRequest struct {
	UID  types.ID   `json:"-"`
	GID  types.ID   `json:"gid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	UIDs []types.ID `json:"uids" validate:"required,min=1,max=20" swaggertype:"array,string" example:"av8FMdRdcb,av8FMdRdcc"` //nolint:lll
}

func (*ChangeGroupMemberRequest) ToPb

type ChangeGroupMemberResponse

type ChangeGroupMemberResponse struct {
	Count int `json:"count" example:"1"`
}

type CheckSendMessageAbilityRequest

type CheckSendMessageAbilityRequest struct {
	FromUID     types.ID `json:"fromUid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	ToUID       types.ID `json:"toUid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	SessionType int32    `json:"sessionType" validate:"required,gte=0,lte=255" example:"0"`
}

func (*CheckSendMessageAbilityRequest) ToPb

type ConfirmFriendRequestRequest

type ConfirmFriendRequestRequest struct {
	UID             types.ID `json:"-"`
	FriendRequestID uint64   `json:"friendRequestId" validate:"required" example:"2"`
	Action          int32    `json:"-"`
}

func (*ConfirmFriendRequestRequest) ToPb

type CreateGroupRequest

type CreateGroupRequest struct {
	UID     types.ID   `json:"-"`
	Name    string     `json:"name" validate:"required,max=32" example:"test"`
	Desc    string     `json:"desc" validate:"omitempty,max=128" example:"test"`
	Avatar  string     `json:"avatar" validate:"omitempty,url" example:"https://example.com/avatar.png"`
	Members []types.ID `json:"members" validate:"required,min=2,max=20" swaggertype:"array,string" example:"av8FMdRdcb,av8FMdRdcc"` //nolint:lll
}

func (*CreateGroupRequest) ToPb

type CreateUserRequest

type CreateUserRequest struct {
	// Email and Phone only one can be set
	Email    *string `json:"email" validate:"omitempty,email" example:"user1@example.com"`
	Phone    *string `json:"phone" validate:"omitempty,regexp=^1[3456789]\\d{9}$" example:"13800138000"`
	Password string  `json:"password" validate:"required,min=6,max=20" example:"123456"`
	Name     string  `json:"name" validate:"required,min=2,max=32" example:"user1"`
}

func (*CreateUserRequest) ToPb

type DeleteGroupRequest

type DeleteGroupRequest struct {
	UID types.ID `json:"-"`
	GID types.ID `json:"gid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
}

func (*DeleteGroupRequest) ToPb

type Friend

type Friend struct {
	UID          types.ID `json:"uid" swaggertype:"string" example:"av8FMdRdcb"`
	FriendUID    types.ID `json:"friendUid" swaggertype:"string" example:"av8FMdRdcb"`
	FriendName   string   `json:"friendName" example:"friendName"`
	FriendAvatar string   `json:"friendAvatar" example:"https://www.example.com/friendAvatar.png"`
	// 0: friend, 1: stranger, 2: blacklist
	Status    int32 `json:"status" example:"0"`
	CreatedAt int64 `json:"createdAt" example:"1579098983"`
	UpdatedAt int64 `json:"updatedAt" example:"1579098983"`
}

func FriendFromPb

func FriendFromPb(pb *friendv1.Friend) *Friend

func FriendsFromPb

func FriendsFromPb(pb []*friendv1.Friend) []*Friend

type FriendRequest

type FriendRequest struct {
	ID           uint64   `json:"id" example:"1"`
	UID          types.ID `json:"uid" swaggertype:"string" example:"av8FMdRdcb"`
	FriendUID    types.ID `json:"friendUid" swaggertype:"string" example:"av8FMdRdcb"`
	FriendName   string   `json:"friendName" example:"friendName"`
	FriendAvatar string   `json:"friendAvatar" example:"https://www.example.com/friendAvatar.png"`
	// 0: pending, 1: accepted, 2: rejected
	Status    int32 `json:"status" example:"0"`
	CreatedAt int64 `json:"createdAt" example:"1579098983"`
	UpdatedAt int64 `json:"updatedAt" example:"1579098983"`
}

func FriendRequestFromPb

func FriendRequestFromPb(pb *friendv1.FriendRequest) *FriendRequest

func FriendRequestListFromPb

func FriendRequestListFromPb(pb []*friendv1.FriendRequest) []*FriendRequest

type GetGroupRequest

type GetGroupRequest struct {
	UID         types.ID `form:"-"`
	GID         types.ID `form:"gid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	WithMembers bool     `form:"with_members" example:"true"`
	// WithInfo valid only when withMembers is true
	WithInfo bool `form:"with_info" example:"true"`
}

func (*GetGroupRequest) ToPb

type Group

type Group struct {
	GID         types.ID       `json:"gid" swaggertype:"string" example:"av8FMdRdcb"`
	Name        string         `json:"name" example:"test"`
	Desc        string         `json:"desc" example:"test"`
	Avatar      string         `json:"avatar" example:"https://example.com/avatar.png"`
	OwnerUID    types.ID       `json:"owner_uid" swaggertype:"string" example:"av8FMdRdcb"`
	Owner       *GroupMember   `json:"owner,omitempty"`
	Members     []*GroupMember `json:"members,omitempty"`
	MaxMembers  int32          `json:"max_member" example:"20"`
	MemberCount int32          `json:"member_count" example:"2"`
	Status      int32          `json:"status" example:"1"`
}

func GroupFromPb

func GroupFromPb(pb *grouppb.Group) *Group

func GroupsFromPb

func GroupsFromPb(pb []*grouppb.Group) []*Group

type GroupMember

type GroupMember struct {
	GID  types.ID `json:"gid" swaggertype:"string" example:"av8FMdRdcb"`
	UID  types.ID `json:"uid" swaggertype:"string" example:"av8FMdRdcb"`
	User *User    `json:"user,omitempty"` // only when withMembers is true and withInfo is true
	// 0: normal, 1: silent
	Status int32 `json:"status" example:"1"`
	// 0: owner, 1: member
	Type int32 `json:"type" example:"1"`
}

func GroupMemberFromPb

func GroupMemberFromPb(pb *grouppb.GroupMember) *GroupMember

type Message

type Message struct {
	MessageID   int64    `json:"messageId" example:"1"`
	From        types.ID `json:"from" swaggertype:"string" example:"av8FMdRdcb"`
	To          types.ID `json:"to" swaggertype:"string" example:"av8FMdRdcb"`
	SessionType int32    `json:"sessionType" example:"1"`
	SessionID   string   `json:"sessionId" example:"1"`
	ContentType int32    `json:"contentType" example:"1"`
	Content     string   `json:"content" example:"hello"`
	CreateTime  int64    `json:"createTime" example:"1579098983"`
}

func MessageFromPb

func MessageFromPb(pb *messagev1.Message) *Message

func MessagesFromPb

func MessagesFromPb(pb []*messagev1.Message) []*Message

type QueryFriendRequestListRequest

type QueryFriendRequestListRequest struct {
	UID    types.ID `json:"-" form:"-"`
	Status int32    `form:"status" validate:"required,oneof=0 1" example:"0"`
}

func (*QueryFriendRequestListRequest) ToPb

type QueryOfflineMessageReq

type QueryOfflineMessageReq struct {
	UID           types.ID `form:"-"`
	LastMessageID int64    `form:"lastMessageId" validate:"required" example:"1"`
	OnlyCount     bool     `form:"onlyCount" example:"true"`
	*web.Paging
}

func (*QueryOfflineMessageReq) ToPb

type QueryUserRequest

type QueryUserRequest struct {
	// Email and Phone only one can be set
	Email *string `form:"email" validate:"omitempty,email" example:"user1@example.com"`
	Phone *string `form:"phone" validate:"omitempty,regexp=^1[3456789]\\d{9}$" example:"13800138000"`
}

func (*QueryUserRequest) ToPb

type SendMessageReq

type SendMessageReq struct {
	From        types.ID `json:"from" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	To          types.ID `json:"to" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	SessionType int32    `json:"sessionType" validate:"required" example:"1"`
	SessionID   *string  `json:"sessionId" validate:"required" example:"1"`
	ContentType int32    `json:"contentType" validate:"required" example:"1"`
	Content     string   `json:"content" validate:"required" example:"hello"`
}

func (*SendMessageReq) ToPb

type SendMessageResp

type SendMessageResp struct {
	MessageID int64  `json:"messageId" example:"1"`
	SessionID string `json:"sessionId" example:"abc"`
}

type UpdateFriendStatusRequest

type UpdateFriendStatusRequest struct {
	UID       types.ID `json:"uid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	FriendUID types.ID `json:"friendUid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	Status    int32    `json:"status" validate:"required,oneof=0 1 2 3" example:"0"`
}

func (*UpdateFriendStatusRequest) ToPb

type UpdateGroupRequest

type UpdateGroupRequest struct {
	UID    types.ID `json:"-"`
	GID    types.ID `json:"gid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"`
	Name   *string  `json:"name" validate:"omitempty,max=32" example:"test"`
	Desc   *string  `json:"desc" validate:"omitempty,max=128" example:"test"`
	Avatar *string  `json:"avatar" validate:"omitempty,url" example:"https://www.example.com/avatar.png"`
}

func (*UpdateGroupRequest) ToPb

type UpdateUserRequest

type UpdateUserRequest struct {
	Email    *string `json:"email" validate:"omitempty,email" example:"user1@example.com"`
	Phone    *string `json:"phone" validate:"omitempty,regexp=^1[3456789]\\d{9}$" example:"13800138000"`
	Name     *string `json:"name" validate:"omitempty,min=2,max=32" example:"user1"`
	Password *string `json:"password" validate:"omitempty,min=6,max=20" example:"123456"`
	Avatar   *string `json:"avatar" validate:"omitempty,url" example:"https://www.example.com/avatar.png"`
}

func (*UpdateUserRequest) ToPb

type User

type User struct {
	UID         types.ID `json:"uid" swaggertype:"string" example:"av8FMdRdcb"`
	Name        string   `json:"name" example:"user1"`
	Avatar      string   `json:"avatar" example:"https://www.example.com/avatar.png"`
	Email       *string  `json:"email,omitempty" example:"abc@example.com"`
	Phone       *string  `json:"phone,omitempty" example:"13800138000"`
	ConnectURL  *string  `json:"connectUrl,omitempty" example:"ws://10.0.0.1:8080/ws"`
	LoginStatus int32    `json:"loginStatus" example:"0"`
}

func UserFromPb

func UserFromPb(pb *userv1.User) *User

type UserLoginRequest

type UserLoginRequest struct {
	// Email and Phone only one can be set
	Email     *string `json:"email" validate:"omitempty,email" example:"user1@example.com"`
	Phone     *string `json:"phone" validate:"omitempty,regexp=^1[3456789]\\d{9}$" example:"13800138000"`
	Password  string  `json:"password" validate:"required,min=6,max=20" example:"123456"`
	LoginType int32   `json:"loginType" validate:"required,oneof=0 1" example:"0"`
}

func (*UserLoginRequest) ToPb

Jump to

Keyboard shortcuts

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