service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAuth

func RegisterAuth(i IAuth)

func RegisterCommon

func RegisterCommon(i ICommon)

func RegisterContact

func RegisterContact(i IContact)

func RegisterContactApply

func RegisterContactApply(i IContactApply)

func RegisterContactGroup

func RegisterContactGroup(i IContactGroup)

func RegisterEmail

func RegisterEmail(i IEmail)

func RegisterEmoticon

func RegisterEmoticon(i IEmoticon)

func RegisterFile

func RegisterFile(i IFile)

func RegisterGroup

func RegisterGroup(i IGroup)

func RegisterGroupApply

func RegisterGroupApply(i IGroupApply)

func RegisterGroupNotice

func RegisterGroupNotice(i IGroupNotice)

func RegisterNote

func RegisterNote(i INote)

func RegisterNoteAnnex

func RegisterNoteAnnex(i INoteAnnex)

func RegisterNoteClass

func RegisterNoteClass(i INoteClass)

func RegisterNoteTag

func RegisterNoteTag(i INoteTag)

func RegisterRobot

func RegisterRobot(i IRobot)

func RegisterSession

func RegisterSession(i ISession)

func RegisterSms

func RegisterSms(i ISms)

func RegisterTalkMessage

func RegisterTalkMessage(i ITalkMessage)

func RegisterTalkRecords

func RegisterTalkRecords(i ITalkRecords)

func RegisterTalkSession added in v1.0.0

func RegisterTalkSession(i ITalkSession)

func RegisterUser

func RegisterUser(i IUser)

Types

type IAuth

type IAuth interface {
	// 注册接口
	Register(ctx context.Context, params model.RegisterReq) error
	// 登录接口
	Login(ctx context.Context, params model.LoginReq) (res *model.LoginRes, err error)
	// 退出登录接口
	Logout(ctx context.Context) error
	// 账号找回接口
	Forget(ctx context.Context, params model.ForgetReq) error
	// Token 刷新接口
	Refresh(ctx context.Context) (*model.RefreshRes, error)
}

func Auth

func Auth() IAuth

type ICommon

type ICommon interface {
	// 发送短信验证码
	SmsCode(ctx context.Context, params model.SendSmsReq) (*model.SendSmsRes, error)
	// 发送邮件验证码
	EmailCode(ctx context.Context, params model.SendEmailReq) (*model.SendEmailRes, error)
	// 公共设置
	Setting(ctx context.Context) error
}

func Common

func Common() ICommon

type IContact

type IContact interface {
	// List 好友列表
	List(ctx context.Context) (*model.ContactListRes, error)
	// Delete 删除好友
	Delete(ctx context.Context, params model.ContactDeleteReq) error
	// Search 查找好友
	Search(ctx context.Context, params model.ContactSearchReq) (*model.ContactSearchRes, error)
	// Remark 编辑好友备注
	Remark(ctx context.Context, params model.ContactEditRemarkReq) error
	// Detail 好友详情信息
	Detail(ctx context.Context, params model.ContactDetailReq) (*model.ContactDetailRes, error)
	// MoveGroup 移动好友分组
	MoveGroup(ctx context.Context, params model.ContactChangeGroupReq) error
}

func Contact

func Contact() IContact

type IContactApply

type IContactApply interface {
	// 好友申请列表
	List(ctx context.Context) ([]*model.Apply, error)
	// 创建好友申请
	Create(ctx context.Context, params model.ApplyCreateReq) (string, error)
	// 同意好友申请
	Accept(ctx context.Context, params model.ApplyAcceptReq) (*model.ContactApply, error)
	// 拒绝好友申请
	Decline(ctx context.Context, params model.ApplyDeclineReq) error
	// 获取好友申请未读数
	ApplyUnreadNum(ctx context.Context) (int, error)
	// 清除申请未读数
	ClearApplyUnreadNum(ctx context.Context, uid int)
}

func ContactApply

func ContactApply() IContactApply

type IContactGroup

type IContactGroup interface {
	Delete(ctx context.Context, id int, uid int) error
	// 好友分组列表
	List(ctx context.Context) (*model.ContactGroupListRes, error)
	Save(ctx context.Context, params model.GroupSaveReq) error
}

func ContactGroup

func ContactGroup() IContactGroup

type IEmail

type IEmail interface {
	// Verify 验证邮件验证码是否正确
	Verify(ctx context.Context, channel string, email string, code string) bool
	// Delete 删除邮件验证码记录
	Delete(ctx context.Context, channel string, email string)
	// Send 发送邮件
	Send(ctx context.Context, channel string, emailAddr string) (string, error)
}

func Email

func Email() IEmail

type IEmoticon

type IEmoticon interface {
	// 收藏列表
	CollectList(ctx context.Context) ([]*model.CollectEmoticon, error)
	// 删除收藏表情包
	DeleteCollect(ctx context.Context, params model.DeleteReq) error
	// 上传自定义表情包
	Upload(ctx context.Context) (*model.UploadRes, error)
}

func Emoticon

func Emoticon() IEmoticon

type IFile

type IFile interface {
	// 头像上传上传
	Avatar(ctx context.Context) (*model.UploadAvatarRes, error)
	// 图片上传
	Image(ctx context.Context) (*model.UploadImageRes, error)
	// 批量上传初始化
	InitiateMultipart(ctx context.Context, params model.UploadInitiateMultipartReq) (*model.UploadInitiateMultipartRes, error)
	// 批量分片上传
	MultipartSplitUpload(ctx context.Context, params model.UploadMultipartReq) (*model.UploadMultipartRes, error)
}

func File

func File() IFile

type IGroup

type IGroup interface {
	// 创建群聊分组
	Create(ctx context.Context, params model.GroupCreateReq) (*model.GroupCreateRes, error)
	// 解散群聊
	Dismiss(ctx context.Context, params model.GroupDismissReq) error
	// 邀请好友加入群聊
	Invite(ctx context.Context, params model.GroupInviteReq) error
	// 退出群聊
	Secede(ctx context.Context, params model.GroupSecedeReq) error
	// 群设置接口(预留)
	Setting(ctx context.Context, params model.GroupSettingReq) error
	// 移除指定成员(群聊&管理员权限)
	RemoveMembers(ctx context.Context, params model.GroupRemoveMemberReq) error
	// 获取群聊信息
	Detail(ctx context.Context, params model.GroupDetailReq) (*model.GroupDetailRes, error)
	// 修改群备注接口
	UpdateMemberRemark(ctx context.Context, params model.GroupRemarkUpdateReq) error
	GetInviteFriends(ctx context.Context, params model.GetInviteFriendsReq) ([]*model.ContactListItem, error)
	List(ctx context.Context) (*model.GroupListRes, error)
	// 获取群成员列表
	Members(ctx context.Context, params model.GroupMemberListReq) (*model.GroupMemberListRes, error)
	// 公开群列表
	OvertList(ctx context.Context, params model.GroupOvertListReq) (*model.GroupOvertListRes, error)
	// 群主交接
	Handover(ctx context.Context, params model.GroupHandoverReq) error
	// 分配管理员
	AssignAdmin(ctx context.Context, params model.GroupAssignAdminReq) error
	// 禁止发言
	NoSpeak(ctx context.Context, params model.GroupNoSpeakReq) error
	// 全员禁言
	Mute(ctx context.Context, params model.GroupMuteReq) error
	// 公开群
	Overt(ctx context.Context, params model.GroupOvertReq) error
}

func Group

func Group() IGroup

type IGroupApply

type IGroupApply interface {
	Create(ctx context.Context, params model.GroupApplyCreateReq) error
	Agree(ctx context.Context, params model.ApplyAgreeReq) error
	Decline(ctx context.Context, params model.GroupApplyDeclineReq) error
	List(ctx context.Context, params model.ApplyListReq) (*model.GroupApplyListRes, error)
	All(ctx context.Context) (*model.ApplyAllRes, error)
	ApplyUnreadNum(ctx context.Context) (*model.GroupApplyUnreadNumRes, error)
	Delete(ctx context.Context, applyId string, userId int) error
}

func GroupApply

func GroupApply() IGroupApply

type IGroupNotice

type IGroupNotice interface {
	// 群公告列表
	List(ctx context.Context, params model.NoticeListReq) (*model.NoticeListRes, error)
	// 发布或更新群公告
	CreateAndUpdate(ctx context.Context, params model.NoticeEditReq) error
	// 删除群公告
	Delete(ctx context.Context, params model.NoticeDeleteReq) error
}

func GroupNotice

func GroupNotice() IGroupNotice

type INote

type INote interface {
	// 笔记列表
	List(ctx context.Context, params model.NoteListReq) (*model.NoteListRes, error)
	// 笔记详情
	Detail(ctx context.Context, params model.NoteDetailReq) (*model.NoteDetailRes, error)
	// 添加或编辑笔记
	Edit(ctx context.Context, params model.NoteEditReq) (*model.NoteEditRes, error)
	// 删除笔记
	Delete(ctx context.Context, params model.NoteDeleteReq) error
	// 恢复笔记
	Recover(ctx context.Context, params model.NoteRecoverReq) error
	// 笔记图片上传
	Upload(ctx context.Context) (*model.NoteUploadImageRes, error)
	// 笔记移动
	Move(ctx context.Context, params model.NoteMoveReq) error
	// 标记笔记
	Asterisk(ctx context.Context, params model.NoteAsteriskReq) error
	// 笔记标签
	Tag(ctx context.Context, params model.NoteTagsReq) error
	// 永久删除笔记
	ForeverDelete(ctx context.Context, params model.NoteForeverDeleteReq) error
}

func Note

func Note() INote

type INoteAnnex

type INoteAnnex interface {
	Create(ctx context.Context, data *model.NoteAnnex) error
	// 上传附件
	Upload(ctx context.Context, params model.AnnexUploadReq) (*model.AnnexUploadRes, error)
	// 删除附件
	Delete(ctx context.Context, params model.AnnexDeleteReq) error
	// 恢复附件
	Recover(ctx context.Context, params model.AnnexRecoverReq) error
	// 附件回收站列表
	RecoverList(ctx context.Context) (*model.AnnexRecoverListRes, error)
	// 永久删除附件
	ForeverDelete(ctx context.Context, params model.AnnexForeverDeleteReq) error
	// 下载笔记附件
	Download(ctx context.Context, params model.AnnexDownloadReq) error
}

func NoteAnnex

func NoteAnnex() INoteAnnex

type INoteClass

type INoteClass interface {
	// List 分类列表
	List(ctx context.Context) (*model.ClassListRes, error)
	// Edit 添加或修改分类
	Edit(ctx context.Context, params model.ClassEditReq) (*model.ClassEditRes, error)
	// Delete 删除分类
	Delete(ctx context.Context, params model.ClassDeleteReq) error
	// Sort 删除分类
	Sort(ctx context.Context, params model.ClassSortReq) error
}

func NoteClass

func NoteClass() INoteClass

type INoteTag

type INoteTag interface {
	// List 标签列表
	List(ctx context.Context) (*model.TagListRes, error)
	// Edit 添加或修改标签
	Edit(ctx context.Context, params model.TagEditReq) (*model.TagEditRes, error)
	// Delete 删除标签
	Delete(ctx context.Context, params model.TagDeleteReq) error
}

func NoteTag

func NoteTag() INoteTag

type IRobot

type IRobot interface {
	GetRobotByUserId(ctx context.Context, userId int) (*model.Robot, error)
}

func Robot

func Robot() IRobot

type ISession

type ISession interface {
	// 获取会话中UserId
	GetUid(ctx context.Context) int
	// 获取会话中用户信息
	GetUser(ctx context.Context) *model.User
}

func Session

func Session() ISession

type ISms

type ISms interface {
	// Verify 验证短信验证码是否正确
	Verify(ctx context.Context, channel string, mobile string, code string) bool
	// Delete 删除短信验证码记录
	Delete(ctx context.Context, channel string, mobile string)
	// Send 发送短信
	Send(ctx context.Context, channel string, mobile string) (string, error)
}

func Sms

func Sms() ISms

type ITalkMessage

type ITalkMessage interface {
	// 校验权限
	VerifyPermission(ctx context.Context, info *model.VerifyInfo) error
	// 发送消息
	SendMessage(ctx context.Context, message *model.Message) (err error)
	// 发送系统消息
	SendSysMessage(ctx context.Context, message *model.SysMessage) error
	// 发送通知消息
	SendNoticeMessage(ctx context.Context, message *model.NoticeMessage) error
	// 文件消息
	SendFile(ctx context.Context, uid int, req *model.MessageFileReq) error
	// 投票消息
	SendVote(ctx context.Context, uid int, req *model.MessageVoteReq) error
	// 撤回消息
	Revoke(ctx context.Context, params model.MessageRevokeReq) error
	// 发送图片消息
	Image(ctx context.Context, params model.ImageMessageReq) error
	// 发送文件消息
	File(ctx context.Context, params model.MessageFileReq) error
	// 发送投票消息
	Vote(ctx context.Context, params model.MessageVoteReq) error
	// 投票处理
	HandleVote(ctx context.Context, params model.MessageVoteHandleReq) (*model.VoteStatistics, error)
	// 删除消息记录
	Delete(ctx context.Context, params model.MessageDeleteReq) error
	// 验证转发消息合法性
	Verify(ctx context.Context, uid int, params *model.ForwardMessageReq) error
	// 批量合并转发
	MultiMergeForward(ctx context.Context, uid int, params *model.ForwardMessageReq) ([]*model.ForwardRecord, error)
	// 批量逐条转发
	MultiSplitForward(ctx context.Context, uid int, params *model.ForwardMessageReq) ([]*model.ForwardRecord, error)
	// 收藏表情包
	Collect(ctx context.Context, params model.MessageCollectReq) error
	// 发送消息接口
	Publish(ctx context.Context, params model.MessagePublishReq) error
	TextMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	CodeMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	ImageMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	VoiceMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	VideoMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	FileMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	VoteMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	MixedMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	// todo
	ForwardMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	EmoticonMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	CardMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
	LocationMessageHandler(ctx context.Context, message *model.Message) (*model.TalkRecord, error)
}

func TalkMessage

func TalkMessage() ITalkMessage

type ITalkRecords

type ITalkRecords interface {
	// 获取对话消息
	GetTalkRecords(ctx context.Context, opt *model.QueryTalkRecordsOpt) ([]*model.TalkRecordsItem, error)
	// 对话搜索消息
	SearchTalkRecords()
	GetTalkRecord(ctx context.Context, recordId int) (*model.TalkRecordsItem, error)
	// 获取转发消息记录
	GetForwardRecords(ctx context.Context, params model.RecordsForwardReq) ([]*model.TalkRecordsItem, error)
	HandleTalkRecords(ctx context.Context, items []*model.TalkRecordsItem) ([]*model.TalkRecordsItem, error)
	// 获取会话记录
	GetRecords(ctx context.Context, params model.TalkRecordsReq) (*model.TalkRecordsRes, error)
	// 查询下会话记录
	SearchHistoryRecords(ctx context.Context, params model.TalkRecordsReq) (*model.TalkRecordsRes, error)
	// 聊天文件下载
	Download(ctx context.Context, recordId int) error
}

func TalkRecords

func TalkRecords() ITalkRecords

type ITalkSession added in v1.0.0

type ITalkSession interface {
	// 创建会话列表
	Create(ctx context.Context, params model.SessionCreateReq) (*model.SessionCreateRes, error)
	// 删除列表
	Delete(ctx context.Context, params model.SessionDeleteReq) error
	// 置顶列表
	Top(ctx context.Context, params model.SessionTopReq) error
	// 会话免打扰
	Disturb(ctx context.Context, params model.SessionDisturbReq) error
	// 会话列表
	List(ctx context.Context) (*model.SessionListRes, error)
	// 清除消息未读数
	ClearUnreadMessage(ctx context.Context, params model.SessionClearUnreadNumReq) error
	// 会话免打扰
	OpenContext(ctx context.Context, params model.SessionOpenContextReq) error
	// 获取会话
	FindBySession(ctx context.Context, uid int, receiverId int, talkType int) (*model.TalkSession, error)
}

func TalkSession added in v1.0.0

func TalkSession() ITalkSession

type IUser

type IUser interface {
	// 用户详情
	Detail(ctx context.Context) (*model.UserDetailRes, error)
	// 修改用户信息
	ChangeDetail(ctx context.Context, params model.UserDetailUpdateReq) error
	// 修改密码接口
	ChangePassword(ctx context.Context, params model.UserPasswordUpdateReq) (err error)
	// 用户设置
	Setting(ctx context.Context) (*model.UserSettingRes, error)
	// 换绑手机号
	ChangeMobile(ctx context.Context, params model.UserMobileUpdateReq) error
	// 换绑邮箱
	ChangeEmail(ctx context.Context, params model.UserEmailUpdateReq) error
	// 根据userId获取用户信息
	GetUserById(ctx context.Context, userId int) (*model.User, error)
}

func User

func User() IUser

Jump to

Keyboard shortcuts

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