service

package
v0.9.23 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterApply

func RegisterApply(i IApply)

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 RegisterGroupMember

func RegisterGroupMember(i IGroupMember)

func RegisterGroupNotice

func RegisterGroupNotice(i IGroupNotice)

func RegisterIpAddress

func RegisterIpAddress(i IIpAddress)

func RegisterMessage

func RegisterMessage(i IMessage)

func RegisterMessageForward

func RegisterMessageForward(i IMessageForward)

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 RegisterPublish

func RegisterPublish(i IPublish)

func RegisterRecords

func RegisterRecords(i IRecords)

func RegisterRobot

func RegisterRobot(i IRobot)

func RegisterServerConsume

func RegisterServerConsume(i IServerConsume)

func RegisterServerEvent

func RegisterServerEvent(i IServerEvent)

func RegisterServerSubscribe

func RegisterServerSubscribe(i IServerSubscribe)

func RegisterSession

func RegisterSession(i ISession)

func RegisterSms

func RegisterSms(i ISms)

func RegisterSplitUpload

func RegisterSplitUpload(i ISplitUpload)

func RegisterTalk

func RegisterTalk(i ITalk)

func RegisterTalkMessage

func RegisterTalkMessage(i ITalkMessage)

func RegisterTalkRecords

func RegisterTalkRecords(i ITalkRecords)

func RegisterUser

func RegisterUser(i IUser)

Types

type IApply

type IApply interface {
	// ApplyUnreadNum 获取好友申请未读数
	ApplyUnreadNum(ctx context.Context) (int, error)
	// Create 创建联系人申请
	Create(ctx context.Context, params model.ContactApplyCreateReq) error
	// Accept 同意联系人添加申请
	Accept(ctx context.Context, params model.ContactApplyAcceptReq) error
	// Decline 拒绝联系人添加申请
	Decline(ctx context.Context, params model.ContactApplyDeclineReq) error
	// List 获取联系人申请列表
	List(ctx context.Context) (*model.ContactApplyListRes, error)
}

func Apply

func Apply() IApply

type IAuth

type IAuth interface {
	// Login 登录接口
	Login(ctx context.Context, params model.AuthLoginReq) (*model.AuthLoginRes, error)
	// Register 注册接口
	Register(ctx context.Context, params model.AuthRegisterReq) error
	// Logout 退出登录接口
	Logout(ctx context.Context) error
	// Refresh Token 刷新接口
	Refresh(ctx context.Context) (*model.AuthRefreshRes, error)
	// Forget 账号找回接口
	Forget(ctx context.Context, params model.AuthForgetReq) error
}

func Auth

func Auth() IAuth

type ICommon

type ICommon interface {
	// SmsCode 发送短信验证码
	SmsCode(ctx context.Context, params model.CommonSendSmsReq) (*model.CommonSendSmsRes, error)
	// EmailCode 发送邮件验证码
	EmailCode(ctx context.Context, params model.CommonSendEmailReq) (*model.CommonSendEmailRes, error)
	// Setting 公共设置
	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 {
	// 创建好友申请
	Create(ctx context.Context, apply *model.ContactApply) (string, error)
	// 同意好友申请
	Accept(ctx context.Context, apply *model.ContactApply) (*model.ContactApply, error)
	// 拒绝好友申请
	Decline(ctx context.Context, apply *model.ContactApply) error
	// 好友申请列表
	List(ctx context.Context, uid int) ([]*model.ApplyItem, error)
	// 获取申请未读数
	GetApplyUnreadNum(ctx context.Context, uid int) int
	// 清除申请未读数
	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
	// GetUserGroup 用户联系人分组列表
	GetUserGroup(ctx context.Context, uid int) ([]*model.ContactGroup, error)
	// List 联系人分组列表
	List(ctx context.Context) (*model.ContactGroupListRes, error)
	Save(ctx context.Context, params model.ContactGroupSaveReq) 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 收藏列表
	CollectList(ctx context.Context) (*model.EmoticonListRes, error)
	// DeleteCollect 删除收藏表情包
	DeleteCollect(ctx context.Context, params model.EmoticonDeleteReq) error
	// Upload 上传自定义表情包
	Upload(ctx context.Context) (*model.EmoticonUploadRes, error)
	// SystemList 系统表情包列表
	SystemList(ctx context.Context) ([]*model.EmoticonSysListResponse_Item, error)
	// SetSystemEmoticon 添加或移除系统表情包
	SetSystemEmoticon(ctx context.Context, params model.EmoticonSetSystemReq) (*model.EmoticonSetSystemRes, 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)
	// MultipartUpload 批量分片上传
	MultipartUpload(ctx context.Context, params model.UploadMultipartReq) (*model.UploadMultipartRes, error)
}

func File

func File() IFile

type IGroup

type IGroup interface {
	IsAuth(ctx context.Context, opt *model.AuthOption) error
	// Create 创建群聊分组
	Create(ctx context.Context, params model.GroupCreateReq) (*model.GroupCreateRes, error)
	// Dismiss 解散群聊
	Dismiss(ctx context.Context, params model.GroupDismissReq) error
	// Invite 邀请好友加入群聊
	Invite(ctx context.Context, params model.GroupInviteReq) error
	// SignOut 退出群聊
	SignOut(ctx context.Context, params model.GroupSecedeReq) error
	// Setting 群设置接口(预留)
	Setting(ctx context.Context, params model.GroupSettingReq) error
	// RemoveMembers 移除指定成员(群聊&管理员权限)
	RemoveMembers(ctx context.Context, params model.GroupRemoveMemberReq) error
	// Detail 获取群聊信息
	Detail(ctx context.Context, params model.GroupDetailReq) (*model.GroupDetailRes, error)
	// UpdateMemberRemark 修改群备注接口
	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 获取群成员列表
	Members(ctx context.Context, params model.GroupMemberListReq) (*model.GroupMemberListRes, error)
	// OvertList 公开群列表
	OvertList(ctx context.Context, params model.GroupOvertListReq) (*model.GroupOvertListRes, error)
	// Handover 群主交接
	Handover(ctx context.Context, params model.GroupHandoverReq) error
	// AssignAdmin 分配管理员
	AssignAdmin(ctx context.Context, params model.GroupAssignAdminReq) error
	// NoSpeak 禁止发言
	NoSpeak(ctx context.Context, params model.GroupNoSpeakReq) error
	// Mute 全员禁言
	Mute(ctx context.Context, params model.GroupMuteReq) error
	// Overt 公开群
	Overt(ctx context.Context, params model.GroupOvertReq) error
	// Secede 退出群聊[仅管理员及群成员]
	Secede(ctx context.Context, groupId int, uid int) 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.GroupApplyAgreeReq) error
	Decline(ctx context.Context, params model.GroupApplyDeclineReq) error
	List(ctx context.Context, params model.GroupApplyListReq) (*model.GroupApplyListRes, error)
	All(ctx context.Context) (*model.GroupApplyAllRes, error)
	ApplyUnreadNum(ctx context.Context) (*model.ApplyUnreadNumRes, error)
	Delete(ctx context.Context, applyId string, userId int) error
}

func GroupApply

func GroupApply() IGroupApply

type IGroupMember

type IGroupMember interface {
	// Handover 交接群主权限
	Handover(ctx context.Context, groupId int, userId int, memberId int) error
	SetLeaderStatus(ctx context.Context, groupId int, userId int, leader int) error
	SetMuteStatus(ctx context.Context, groupId int, userId int, status int) error
}

func GroupMember

func GroupMember() IGroupMember

type IGroupNotice

type IGroupNotice interface {
	// 创建群公告
	GroupNoticeCreate(ctx context.Context, edit *model.GroupNoticeEdit) error
	// 更新群公告
	GroupNoticeUpdate(ctx context.Context, edit *model.GroupNoticeEdit) error
	GroupNoticeDelete(ctx context.Context, groupId int, noticeId string) error
	// 添加或编辑群公告
	CreateAndUpdate(ctx context.Context, params model.GroupNoticeEditReq) (string, error)
	// 删除群公告
	Delete(ctx context.Context, params model.GroupNoticeDeleteReq) (string, error)
	// 获取群公告列表(所有)
	List(ctx context.Context, params model.GroupNoticeListReq) (*model.GroupNoticeListRes, error)
}

func GroupNotice

func GroupNotice() IGroupNotice

type IIpAddress

type IIpAddress interface {
	FindAddress(ctx context.Context, ip string) (string, error)
}

func IpAddress

func IpAddress() IIpAddress

type IMessage

type IMessage interface {
	// Text 发送文本消息
	Text(ctx context.Context, params model.TextMessageReq) error
	// Code 发送代码块消息
	Code(ctx context.Context, params model.CodeMessageReq) error
	// Image 发送图片消息
	Image(ctx context.Context, params model.ImageMessageReq) error
	// File 发送文件消息
	File(ctx context.Context, params model.FileMessageReq) error
	// Vote 发送投票消息
	Vote(ctx context.Context, params model.VoteMessageReq) error
	// Emoticon 发送表情包消息
	Emoticon(ctx context.Context, params model.EmoticonMessageReq) error
	// Forward 发送转发消息
	Forward(ctx context.Context, params model.ForwardMessageReq) error
	// Card 发送用户名片消息
	Card(ctx context.Context, params model.CardMessageReq) error
	// Collect 收藏聊天图片
	Collect(ctx context.Context, params model.CollectMessageReq) error
	// Revoke 撤销聊天记录
	Revoke(ctx context.Context, params model.RevokeMessageReq) error
	// Delete 删除聊天记录
	Delete(ctx context.Context, params model.DeleteMessageReq) error
	// HandleVote 投票处理
	HandleVote(ctx context.Context, params model.VoteMessageHandleReq) (*dao.VoteStatistics, error)
	// Location 发送位置消息
	Location(ctx context.Context, params model.LocationMessageReq) error
}

func Message

func Message() IMessage

type IMessageForward

type IMessageForward interface {
	// Verify 验证转发消息合法性
	Verify(ctx context.Context, uid int, params *model.ForwardMessageReq) error
	// MultiMergeForward 批量合并转发
	MultiMergeForward(ctx context.Context, uid int, params *model.ForwardMessageReq) ([]*model.ForwardRecord, error)
	// MultiSplitForward 批量逐条转发
	MultiSplitForward(ctx context.Context, uid int, params *model.ForwardMessageReq) ([]*model.ForwardRecord, error)
}

func MessageForward

func MessageForward() IMessageForward

type INote

type INote interface {
	// List 文章列表
	List(ctx context.Context, params model.ArticleListReq) (*model.ArticleListRes, error)
	// Detail 文章详情
	Detail(ctx context.Context, params model.ArticleDetailReq) (*model.ArticleDetailRes, error)
	// Edit 添加或编辑文章
	Edit(ctx context.Context, params model.ArticleEditReq) (*model.ArticleEditRes, error)
	// Delete 删除文章
	Delete(ctx context.Context, params model.ArticleDeleteReq) error
	// Recover 恢复文章
	Recover(ctx context.Context, params model.ArticleRecoverReq) error
	// Upload 文章图片上传
	Upload(ctx context.Context) (*model.ArticleUploadImageRes, error)
	// Move 文章移动
	Move(ctx context.Context, params model.ArticleMoveReq) error
	// Asterisk 标记文章
	Asterisk(ctx context.Context, params model.ArticleAsteriskReq) error
	// Tag 文章标签
	Tag(ctx context.Context, params model.ArticleTagsReq) error
	// ForeverDelete 永久删除文章
	ForeverDelete(ctx context.Context, params model.ArticleForeverDeleteReq) error
}

func Note

func Note() INote

type INoteAnnex

type INoteAnnex interface {
	Create(ctx context.Context, data *model.ArticleAnnex) error
	// Upload 上传附件
	Upload(ctx context.Context, params model.ArticleAnnexUploadReq) (*model.ArticleAnnexUploadRes, error)
	// Delete 删除附件
	Delete(ctx context.Context, params model.ArticleAnnexDeleteReq) error
	// Recover 恢复附件
	Recover(ctx context.Context, params model.ArticleAnnexRecoverReq) error
	// RecoverList 附件回收站列表
	RecoverList(ctx context.Context) (*model.ArticleAnnexRecoverListRes, error)
	// ForeverDelete 永久删除附件
	ForeverDelete(ctx context.Context, params model.ArticleAnnexForeverDeleteReq) error
	// Download 下载笔记附件
	Download(ctx context.Context, params model.ArticleAnnexDownloadReq) error
}

func NoteAnnex

func NoteAnnex() INoteAnnex

type INoteClass

type INoteClass interface {
	// List 分类列表
	List(ctx context.Context) (*model.ArticleClassListRes, error)
	// Edit 添加或修改分类
	Edit(ctx context.Context, params model.ArticleClassEditReq) (*model.ArticleClassEditRes, error)
	// Delete 删除分类
	Delete(ctx context.Context, params model.ArticleClassDeleteReq) error
	// Sort 删除分类
	Sort(ctx context.Context, params model.ArticleClassSortReq) error
}

func NoteClass

func NoteClass() INoteClass

type INoteTag

type INoteTag interface {
	// List 标签列表
	List(ctx context.Context) (*model.ArticleTagListRes, error)
	// Edit 添加或修改标签
	Edit(ctx context.Context, params model.ArticleTagEditReq) (*model.ArticleTagEditRes, error)
	// Delete 删除标签
	Delete(ctx context.Context, params model.ArticleTagDeleteReq) error
}

func NoteTag

func NoteTag() INoteTag

type IPublish

type IPublish interface {
	// Publish 发送消息接口
	Publish(ctx context.Context, params model.PublishBaseMessageReq) error
}

func Publish

func Publish() IPublish

type IRecords

type IRecords interface {
	// GetRecords 获取会话记录
	GetRecords(ctx context.Context, params model.GetTalkRecordsReq) (*model.GetTalkRecordsRes, error)
	// SearchHistoryRecords 查询下会话记录
	SearchHistoryRecords(ctx context.Context, params model.GetTalkRecordsReq) (*model.GetTalkRecordsRes, error)
	// GetForwardRecords 获取转发记录
	GetForwardRecords(ctx context.Context, params model.GetForwardTalkRecordReq) (*model.GetTalkRecordsRes, error)
	// Download 聊天文件下载
	Download(ctx context.Context, recordId int) error
}

func Records

func Records() IRecords

type IRobot

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

func Robot

func Robot() IRobot

type IServerConsume

type IServerConsume interface {
	Call(ctx context.Context, event string, data []byte)
}

func ServerConsume

func ServerConsume() IServerConsume

type IServerEvent

type IServerEvent interface {
	Call(ctx context.Context, client socket.IClient, event string, data []byte)
	// 连接成功回调事件
	OnOpen(client socket.IClient)
	// 消息回调事件
	OnMessage(client socket.IClient, message []byte)
	// 连接关闭回调事件
	OnClose(client socket.IClient, code int, text string)
}

func ServerEvent

func ServerEvent() IServerEvent

type IServerSubscribe

type IServerSubscribe interface {
	// 初始化连接
	Conn(w http.ResponseWriter, r *http.Request) error
	NewClient(uid int, conn socket.IConn) error
	// Start 启动服务
	Start(ctx context.Context, eg *errgroup.Group)
	// 注册健康上报
	SetupHealthSubscribe(ctx context.Context) error
	// 注册消息订阅
	SetupMessageSubscribe(ctx context.Context) error
}

func ServerSubscribe

func ServerSubscribe() IServerSubscribe

type ISession

type ISession interface {
	// 获取会话中UserId
	GetUid(ctx context.Context) int
	// 获取会话中用户信息
	GetUser(ctx context.Context) *model.User
	// Create 创建会话列表
	Create(ctx context.Context, params model.TalkSessionCreateReq) (*model.TalkSessionCreateRes, error)
	// Delete 删除列表
	Delete(ctx context.Context, params model.TalkSessionDeleteReq) error
	// Top 置顶列表
	Top(ctx context.Context, params model.TalkSessionTopReq) error
	// Disturb 会话免打扰
	Disturb(ctx context.Context, params model.TalkSessionDisturbReq) error
	// List 会话列表
	List(ctx context.Context) (*model.TalkSessionListRes, error)
	ClearUnreadMessage(ctx context.Context, params model.TalkSessionClearUnreadNumReq) error
}

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 ISplitUpload

type ISplitUpload interface {
	InitiateMultipartUpload(ctx context.Context, params *model.MultipartInitiateOpt) (string, error)
	MultipartUpload(ctx context.Context, opt *model.MultipartUploadOpt) error
}

func SplitUpload

func SplitUpload() ISplitUpload

type ITalk

type ITalk interface {
	// DeleteRecordList 删除消息记录
	DeleteRecordList(ctx context.Context, opt *model.RemoveRecordListOpt) error
	// Collect 收藏表情包
	Collect(ctx context.Context, uid int, recordId int) error
}

func Talk

func Talk() ITalk

type ITalkMessage

type ITalkMessage interface {
	// SendSystemText 系统文本消息
	SendSystemText(ctx context.Context, uid int, req *model.TextMessageReq) error
	// SendText 文本消息
	SendText(ctx context.Context, uid int, req *model.TextMessageReq) error
	// SendImage 图片文件消息
	SendImage(ctx context.Context, uid int, req *model.ImageMessageReq) error
	// SendVoice 语音文件消息
	SendVoice(ctx context.Context, uid int, req *model.VoiceMessageReq) error
	// SendVideo 视频文件消息
	SendVideo(ctx context.Context, uid int, req *model.VideoMessageReq) error
	// SendFile 文件消息
	SendFile(ctx context.Context, uid int, req *model.FileMessageReq) error
	// SendCode 代码消息
	SendCode(ctx context.Context, uid int, req *model.CodeMessageReq) error
	// SendVote 投票消息
	SendVote(ctx context.Context, uid int, req *model.VoteMessageReq) error
	// SendEmoticon 表情消息
	SendEmoticon(ctx context.Context, uid int, req *model.EmoticonMessageReq) error
	// SendForward 转发消息
	SendForward(ctx context.Context, uid int, req *model.ForwardMessageReq) error
	// SendLocation 位置消息
	SendLocation(ctx context.Context, uid int, req *model.LocationMessageReq) error
	// SendBusinessCard 推送用户名片消息
	SendBusinessCard(ctx context.Context, uid int, req *model.CardMessageReq) error
	// SendLogin 推送用户登录消息
	SendLogin(ctx context.Context, uid int, req *model.LoginMessageReq) error
	// SendMixedMessage 图文消息
	SendMixedMessage(ctx context.Context, uid int, req *model.MixedMessageReq) error
	// SendSysOther 推送其它消息
	SendSysOther(ctx context.Context, data *model.TalkRecords) error
	// Revoke 撤回消息
	Revoke(ctx context.Context, uid int, recordId int) error
	// Vote 投票
	Vote(ctx context.Context, uid int, recordId int, optionsValue string) (*dao.VoteStatistics, 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, uid, recordId int) ([]*model.TalkRecordsItem, error)
	HandleTalkRecords(ctx context.Context, items []*model.TalkRecordsItem) ([]*model.TalkRecordsItem, error)
}

func TalkRecords

func TalkRecords() ITalkRecords

type IUser

type IUser interface {
	// 注册
	Register(ctx context.Context, register *model.UserRegister) (*model.User, error)
	// 登录
	Login(ctx context.Context, account string, password string) (*model.User, error)
	// 找回密码
	Forget(ctx context.Context, forget *model.UserForget) (bool, error)
	// 修改密码
	UpdatePassword(ctx context.Context, uid int, oldPassword string, password string) error
	// 用户详情
	Detail(ctx context.Context) (*model.UserDetailRes, error)
	// 用户设置
	Setting(ctx context.Context) (*model.UserSettingRes, error)
	// 修改用户信息
	ChangeDetail(ctx context.Context, params model.UserDetailUpdateReq) error
	// 修改密码接口
	ChangePassword(ctx context.Context, params model.UserPasswordUpdateReq) 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