Documentation ¶
Index ¶
- type AddFriendResult
- type BaseFriendRequest
- type ChangeGroupMemberRequest
- type ChangeGroupMemberResponse
- type CheckSendMessageAbilityRequest
- type ConfirmFriendRequestRequest
- type CreateGroupRequest
- type CreateUserRequest
- type DeleteGroupRequest
- type Friend
- type FriendRequest
- type GetGroupRequest
- type Group
- type GroupMember
- type Message
- type QueryFriendRequestListRequest
- type QueryOfflineMessageReq
- type QueryUserRequest
- type SendMessageReq
- type SendMessageResp
- type UpdateFriendStatusRequest
- type UpdateGroupRequest
- type UpdateUserRequest
- type User
- type UserLoginRequest
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 ¶
func (r *BaseFriendRequest) ToPb() *friendv1.BaseFriendRequest
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 ¶
func (r *ChangeGroupMemberRequest) ToPb() *grouppb.ChangeGroupMemberRequest
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 ¶
func (r *CheckSendMessageAbilityRequest) ToPb() *friendv1.CheckSendMessageAbilityRequest
type ConfirmFriendRequestRequest ¶
type ConfirmFriendRequestRequest struct { UID types.ID `json:"-"` FriendRequestID uint64 `json:"friendRequestId" validate:"required" example:"2"` Action int32 `json:"-"` }
func (*ConfirmFriendRequestRequest) ToPb ¶
func (r *ConfirmFriendRequestRequest) ToPb() *friendv1.ConfirmFriendRequestRequest
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 ¶
func (r *CreateGroupRequest) ToPb() *grouppb.CreateGroupRequest
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 ¶
func (r *CreateUserRequest) ToPb() *userv1.CreateUserRequest
type DeleteGroupRequest ¶
type DeleteGroupRequest struct { UID types.ID `json:"-"` GID types.ID `json:"gid" validate:"required" swaggertype:"string" example:"av8FMdRdcb"` }
func (*DeleteGroupRequest) ToPb ¶
func (r *DeleteGroupRequest) ToPb() *grouppb.DeleteGroupRequest
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 FriendsFromPb ¶
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 ¶
func (r *GetGroupRequest) ToPb() *grouppb.GetGroupRequest
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 GroupsFromPb ¶
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 MessagesFromPb ¶
type QueryFriendRequestListRequest ¶
type QueryFriendRequestListRequest struct { UID types.ID `json:"-" form:"-"` Status int32 `form:"status" validate:"required,oneof=0 1" example:"0"` }
func (*QueryFriendRequestListRequest) ToPb ¶
func (r *QueryFriendRequestListRequest) ToPb() *friendv1.QueryFriendRequestListRequest
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 ¶
func (r *QueryOfflineMessageReq) ToPb() *messagev1.QueryOfflineMessageReq
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 ¶
func (r *QueryUserRequest) ToPb() *userv1.QueryUserRequest
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 ¶
func (r *SendMessageReq) ToPb() *messagev1.SendMessageReq
type SendMessageResp ¶
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 ¶
func (r *UpdateFriendStatusRequest) ToPb() *friendv1.UpdateFriendStatusRequest
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 ¶
func (r *UpdateGroupRequest) ToPb() *grouppb.UpdateGroupRequest
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 ¶
func (r *UpdateUserRequest) ToPb() *userv1.UpdateUserRequest
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 ¶
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 ¶
func (r *UserLoginRequest) ToPb() *userv1.UserLoginRequest
Click to show internal directories.
Click to hide internal directories.