登陆相关Api
/**
* @brief 登陆类型枚举
* */
enum class QRLoginType { QQ, WX };
/**
* @brief 手机号登陆状态枚举
* */
enum class PhoneLoginEvent : int {
SEND = 0, ///< 已发送
CAPTCHA = 20276, ///< 需要滑块验证
FREQUENCY = 100001, ///< 操作过于频繁
OTHER = -1 ///< 其他
};
/**
* @struct PhoneLoginEvent
*
* @brief 手机号登陆事件包装器
* */
struct PhoneLoginResult {
PhoneLoginEvent event;
std::string msg;
};
/**
* @struct QRCode
*
* @brief 二维码信息
* */
struct QRCode {
QRLoginType qr_type; ///< qr code type
std::string identifier; ///< qr code identifier
std::string mimie_type; ///< qr code image type
qqmusic::utils::buffer data; ///< qr code image binary data
};
/**
* @brief 二维码登陆结果封装
* */
struct QRCodeLoginResult {
QRCodeLoginEvent status{QRCodeLoginEvent::Status::OTHER};
std::optional<utils::Credential> credential;
};
Class qqmusic::QRCodeLoginEvent
ClassList > qqmusic > QRCodeLoginEvent
二维码登陆事件
#include <login.h>
Public Types
Type | Name |
---|---|
enum | Status 二维码状态 |
Public Functions
Type | Name |
---|---|
QRCodeLoginEvent (Status stat) 从状态构造 |
|
QRCodeLoginEvent (unsigned int code) 从Http请求返回的状态码构造 |
|
std::string_view | name () const 获取当前状态的名字 |
bool | operator!= (const QRCodeLoginEvent & e) 状态是否不相同 |
bool | operator!= (Status stat) 和枚举直接比较是否不相同 |
bool | operator== (const QRCodeLoginEvent & e) 状态是否相同 |
bool | operator== (Status stat) 和枚举直接比较是否相同 |
Public Types Documentation
enum Status
二维码状态
Public Functions Documentation
function QRCodeLoginEvent [1/2]
从状态构造
function QRCodeLoginEvent [2/2]
从Http请求返回的状态码构造
function name
获取当前状态的名字
function operator!=
状态是否不相同
function operator!=
和枚举直接比较是否不相同
function operator==
状态是否相同
function operator==
和枚举直接比较是否相同
The documentation for this class was generated from the following file include/qqmusic/login.h
function get_qrcode
获取登陆二维码
Parameters:
login_type
登陆类型
Returns:
包含正确结果的Task< Result < QRCode >>
. 如果产生错误, 返回值包含错误结果和错误类型枚举
Note:
异步函数, 返回Task
function check_qq_qr
检查QQ二维码状态
Parameters:
qrc
QQ二维码
Returns:
包含正确结果的Task< Result < QRCodeLoginResult >>
. 如果登陆成功会包含Credential
Note:
异步函数, 返回Task
function check_wx_qr
检查微信二维码状态
Parameters:
qrc
微信二维码
Returns:
包含正确结果的Task< Result < QRCodeLoginResult >>
. 如果登陆成功会包含Credential
Note:
异步函数, 返回Task
function send_authcode
向指定手机号发送验证码
qqmusic::Task< qqmusic::Result< PhoneLoginResult > > qqmusic::send_authcode (
std::string_view phone,
std::string_view country_code="86"
)
Parameters:
phone
手机号country_code
地区前缀
Returns:
qqmusic::Task<qqmusic::Result< PhoneLoginResult >>
出错就会返回Err
Note:
异步函数, 返回Task
Warning:
该函数仍有问题, 不应使用
function phone_authorize
手机号认证
qqmusic::Task< qqmusic::Result< utils::Credential > > qqmusic::phone_authorize (
std::string_view phone,
std::string_view auth_code,
std::string_view country_code="86"
)
Parameters:
phone
手机号auth_code
验证码country_code
地区前缀
Returns:
qqmusic::Task<qqmusic::Result< qqmusic::utils::Credential >>
出错就会返回Err
Note:
异步函数, 返回Task
Warning:
该函数仍有问题, 不应使用