xybot/login/api.go

28 lines
1.2 KiB
Go

package login
import (
"gitee.ltd/lxh/xybot/core"
"github.com/go-resty/resty/v2"
)
type API interface {
GetQRCode(deviceId, deviceName string) (resp GetQRCodeResponse, err error) // 获取登录二维码
AwakenLogin() (resp AwakenLoginResponse, err error) // 唤醒登录
CheckUuid(uuid string) (resp CheckUuidResponse, err error) // 检查登录二维码
AutoHeartbeatStart() (err error) // 启动自动心跳
AutoHeartbeatStatus() (running bool, err error) // 获取自动心跳状态
AutoHeartbeatStop() (err error) // 停止自动心跳
Heartbeat() (err error) // 手动发起心跳
GetCachedInfo() (resp GetCachedInfoResponse, err error) // 获取登录缓存信息
Logout() (err error) // 退出登录
}
type service struct {
client *resty.Client
robotInfo *core.RobotInfo
}
func New(client *resty.Client, robotInfo *core.RobotInfo) API {
return &service{client: client, robotInfo: robotInfo}
}