pub struct Client {
pub online: AtomicBool,
pub heartbeat_enabled: AtomicBool,
pub account_info: RwLock<AccountInfo>,
pub address: RwLock<AddressInfo>,
pub online_clients: RwLock<Vec<OtherClientInfo>>,
pub last_message_time: AtomicI64,
pub start_time: i32,
/* private fields */
}Fields
online: AtomicBoolheartbeat_enabled: AtomicBoolaccount_info: RwLock<AccountInfo>address: RwLock<AddressInfo>online_clients: RwLock<Vec<OtherClientInfo>>last_message_time: AtomicI64start_time: i32Implementations
sourceimpl Client
impl Client
sourcepub async fn get_friend_system_messages(&self) -> RQResult<FriendSystemMessages>
pub async fn get_friend_system_messages(&self) -> RQResult<FriendSystemMessages>
获取好友请求
sourcepub async fn solve_friend_system_message(
&self,
msg_seq: i64,
req_uin: i64,
accept: bool
) -> RQResult<()>
pub async fn solve_friend_system_message(
&self,
msg_seq: i64,
req_uin: i64,
accept: bool
) -> RQResult<()>
处理好友申请
sourcepub async fn _get_friend_list(
&self,
friend_start_index: i16,
friend_list_count: i16,
group_start_index: i16,
group_list_count: i16
) -> RQResult<FriendListResponse>
pub async fn _get_friend_list(
&self,
friend_start_index: i16,
friend_list_count: i16,
group_start_index: i16,
group_list_count: i16
) -> RQResult<FriendListResponse>
获取好友列表 第一个参数offset,从0开始;第二个参数count,150,另外两个都是0
sourcepub async fn delete_friend(&self, del_uin: i64) -> RQResult<()>
pub async fn delete_friend(&self, del_uin: i64) -> RQResult<()>
sourcepub async fn get_friend_list(&self) -> RQResult<FriendListResponse>
pub async fn get_friend_list(&self) -> RQResult<FriendListResponse>
刷新好友列表
sourcepub async fn friend_list_add_group(
&self,
sort_id: u8,
group_name: String
) -> RQResult<()>
pub async fn friend_list_add_group(
&self,
sort_id: u8,
group_name: String
) -> RQResult<()>
好友列表-添加好友分组
sourcepub async fn friend_list_rename_group(
&self,
group_id: u8,
group_name: String
) -> RQResult<()>
pub async fn friend_list_rename_group(
&self,
group_id: u8,
group_name: String
) -> RQResult<()>
好友列表-重命名好友分组
sourcepub async fn friend_list_del_group(&self, group_id: u8) -> RQResult<()>
pub async fn friend_list_del_group(&self, group_id: u8) -> RQResult<()>
好友列表-删除好友分组
sourcepub async fn friend_poke(&self, target: i64) -> RQResult<()>
pub async fn friend_poke(&self, target: i64) -> RQResult<()>
好友戳一戳
sourcepub async fn send_friend_message(
&self,
target: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
pub async fn send_friend_message(
&self,
target: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
发送好友消息
sourcepub async fn send_friend_audio(
&self,
target: i64,
audio: FriendAudio
) -> RQResult<MessageReceipt>
pub async fn send_friend_audio(
&self,
target: i64,
audio: FriendAudio
) -> RQResult<MessageReceipt>
发送好友语音
pub async fn upload_friend_image(
&self,
target: i64,
data: Vec<u8>
) -> RQResult<FriendImage>
pub async fn _upload_friend_image(
&self,
upload_key: Vec<u8>,
addr: SocketAddr,
data: Vec<u8>
) -> RQResult<()>
pub async fn get_off_pic_store(
&self,
target: i64,
image_info: &ImageInfo
) -> RQResult<OffPicUpResp>
分享好友音乐
pub async fn recall_friend_message(
&self,
uin: i64,
msg_time: i64,
seqs: Vec<i32>,
rands: Vec<i32>
) -> RQResult<()>
pub async fn upload_friend_audio(
&self,
target: i64,
data: Vec<u8>,
audio_duration: Duration
) -> RQResult<FriendAudio>
pub async fn get_friend_audio_url(
&self,
sender_uin: i64,
audio: FriendAudio
) -> RQResult<String>
sourcepub async fn mark_friend_message_readed(
&self,
uin: i64,
time: i64
) -> RQResult<()>
pub async fn mark_friend_message_readed(
&self,
uin: i64,
time: i64
) -> RQResult<()>
标记私聊消息已读 TODO 待测试
sourcepub async fn get_friend_rich_sig(
&self,
user_ids: Vec<i64>
) -> RQResult<Vec<RichSigInfo>>
pub async fn get_friend_rich_sig(
&self,
user_ids: Vec<i64>
) -> RQResult<Vec<RichSigInfo>>
获取好友个性签名
sourceimpl Client
impl Client
sourcepub async fn get_all_group_system_messages(
&self
) -> RQResult<GroupSystemMessages>
pub async fn get_all_group_system_messages(
&self
) -> RQResult<GroupSystemMessages>
获取所有进群请求
sourcepub async fn solve_group_system_message(
&self,
msg_seq: i64,
req_uin: i64,
group_code: i64,
suspicious: bool,
is_invite: bool,
accept: bool,
block: bool,
reason: String
) -> RQResult<()>
pub async fn solve_group_system_message(
&self,
msg_seq: i64,
req_uin: i64,
group_code: i64,
suspicious: bool,
is_invite: bool,
accept: bool,
block: bool,
reason: String
) -> RQResult<()>
处理加群申请
sourcepub async fn _get_group_list(
&self,
vec_cookie: &[u8]
) -> RQResult<GroupListResponse>
pub async fn _get_group_list(
&self,
vec_cookie: &[u8]
) -> RQResult<GroupListResponse>
获取群列表 第一个参数offset,从0开始;第二个参数count,150,另外两个都是0
sourcepub async fn send_group_message(
&self,
group_code: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
pub async fn send_group_message(
&self,
group_code: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
发送群消息
sourcepub async fn send_group_audio(
&self,
group_code: i64,
group_audio: GroupAudio
) -> RQResult<MessageReceipt>
pub async fn send_group_audio(
&self,
group_code: i64,
group_audio: GroupAudio
) -> RQResult<MessageReceipt>
发送群语音
sourcepub async fn send_group_temp_message(
&self,
group_code: i64,
user_uin: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
pub async fn send_group_temp_message(
&self,
group_code: i64,
user_uin: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
发送群成员临时消息
sourcepub async fn get_group_member_info(
&self,
group_code: i64,
uin: i64
) -> RQResult<GroupMemberInfo>
pub async fn get_group_member_info(
&self,
group_code: i64,
uin: i64
) -> RQResult<GroupMemberInfo>
获取群成员信息
sourcepub async fn get_group_infos(
&self,
group_codes: Vec<i64>
) -> RQResult<Vec<GroupInfo>>
pub async fn get_group_infos(
&self,
group_codes: Vec<i64>
) -> RQResult<Vec<GroupInfo>>
批量获取群信息
sourcepub async fn get_group_list(&self) -> RQResult<Vec<GroupInfo>>
pub async fn get_group_list(&self) -> RQResult<Vec<GroupInfo>>
刷新群列表
sourcepub async fn get_group_member_list(
&self,
group_code: i64,
group_owner_uin: i64
) -> RQResult<Vec<GroupMemberInfo>>
pub async fn get_group_member_list(
&self,
group_code: i64,
group_owner_uin: i64
) -> RQResult<Vec<GroupMemberInfo>>
获取群成员列表
sourcepub async fn mark_group_message_readed(
&self,
group_code: i64,
seq: i32
) -> RQResult<()>
pub async fn mark_group_message_readed(
&self,
group_code: i64,
seq: i32
) -> RQResult<()>
标记群消息已读
sourcepub async fn group_mute(
&self,
group_code: i64,
member_uin: i64,
duration: Duration
) -> RQResult<()>
pub async fn group_mute(
&self,
group_code: i64,
member_uin: i64,
duration: Duration
) -> RQResult<()>
群禁言 (解除禁言 duration=0)
sourcepub async fn group_set_admin(
&self,
group_code: i64,
member: i64,
flag: bool
) -> RQResult<()>
pub async fn group_set_admin(
&self,
group_code: i64,
member: i64,
flag: bool
) -> RQResult<()>
设置群管理员
flag: true 设置管理员 false 取消管理员
sourcepub async fn group_kick(
&self,
group_code: i64,
member_uins: Vec<i64>,
kick_msg: &str,
block: bool
) -> RQResult<()>
pub async fn group_kick(
&self,
group_code: i64,
member_uins: Vec<i64>,
kick_msg: &str,
block: bool
) -> RQResult<()>
群踢人
pub async fn group_invite(&self, group_code: i64, uin: i64) -> RQResult<()>
pub async fn group_quit(&self, group_code: i64) -> RQResult<()>
sourcepub async fn group_at_all_remain(
&self,
group_code: i64
) -> RQResult<GroupAtAllRemainInfo>
pub async fn group_at_all_remain(
&self,
group_code: i64
) -> RQResult<GroupAtAllRemainInfo>
获取群 @全体成员 剩余次数
sourcepub async fn group_edit_special_title(
&self,
group_code: i64,
member_uin: i64,
new_title: String
) -> RQResult<()>
pub async fn group_edit_special_title(
&self,
group_code: i64,
member_uin: i64,
new_title: String
) -> RQResult<()>
设置群头衔
sourcepub async fn get_anony_info(
&self,
group_code: i64
) -> RQResult<Option<Anonymous>>
pub async fn get_anony_info(
&self,
group_code: i64
) -> RQResult<Option<Anonymous>>
获取自己的匿名信息(用于发送群消息)
分享群音乐
sourcepub async fn edit_group_member_card(
&self,
group_code: i64,
member_uin: i64,
card: String
) -> RQResult<()>
pub async fn edit_group_member_card(
&self,
group_code: i64,
member_uin: i64,
card: String
) -> RQResult<()>
修改群名片
sourcepub async fn recall_group_message(
&self,
group_code: i64,
seqs: Vec<i32>,
rands: Vec<i32>
) -> RQResult<()>
pub async fn recall_group_message(
&self,
group_code: i64,
seqs: Vec<i32>,
rands: Vec<i32>
) -> RQResult<()>
撤回群消息
pub async fn get_group_image_store(
&self,
group_code: i64,
image_info: &ImageInfo
) -> RQResult<GroupImageStoreResp>
pub async fn _upload_group_image(
&self,
upload_key: Vec<u8>,
addr: SocketAddr,
data: Vec<u8>
) -> RQResult<()>
sourcepub async fn upload_group_image(
&self,
group_code: i64,
data: Vec<u8>
) -> RQResult<GroupImage>
pub async fn upload_group_image(
&self,
group_code: i64,
data: Vec<u8>
) -> RQResult<GroupImage>
上传群图片
sourcepub async fn upload_group_audio(
&self,
group_code: i64,
data: Vec<u8>,
codec: u32
) -> RQResult<GroupAudio>
pub async fn upload_group_audio(
&self,
group_code: i64,
data: Vec<u8>,
codec: u32
) -> RQResult<GroupAudio>
上传群音频 codec: 0-amr, 1-silk
pub async fn get_group_audio_url(
&self,
group_code: i64,
audio: GroupAudio
) -> RQResult<String>
pub async fn get_group_short_video_store(
&self,
short_video_upload_req: ShortVideoUploadReq
) -> RQResult<ShortVideoUploadRsp>
sourcepub async fn upload_group_short_video(
&self,
group_code: i64,
video_data: Vec<u8>,
thumb_data: Vec<u8>
) -> RQResult<VideoFile>
pub async fn upload_group_short_video(
&self,
group_code: i64,
video_data: Vec<u8>,
thumb_data: Vec<u8>
) -> RQResult<VideoFile>
上传群短视频 参数:群号,视频数据,封面数据 TODO 未来可能会改成输入 std::io::Read
sourcepub async fn operate_group_essence(
&self,
group_code: i64,
msg_seq: i32,
msg_rand: i32,
flag: bool
) -> RQResult<EacRspBody>
pub async fn operate_group_essence(
&self,
group_code: i64,
msg_seq: i32,
msg_rand: i32,
flag: bool
) -> RQResult<EacRspBody>
设置群精华消息
sourcepub async fn send_group_long_message(
&self,
group_code: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
pub async fn send_group_long_message(
&self,
group_code: i64,
message_chain: MessageChain
) -> RQResult<MessageReceipt>
发送群消息 仅在多张图片时需要,发送文字不需要
sourcepub async fn send_group_forward_message(
&self,
group_code: i64,
msgs: Vec<ForwardMessage>
) -> RQResult<MessageReceipt>
pub async fn send_group_forward_message(
&self,
group_code: i64,
msgs: Vec<ForwardMessage>
) -> RQResult<MessageReceipt>
发送转发消息
sourcepub async fn get_group_admin_list(
&self,
group_code: i64
) -> RQResult<HashMap<i64, GroupMemberPermission>>
pub async fn get_group_admin_list(
&self,
group_code: i64
) -> RQResult<HashMap<i64, GroupMemberPermission>>
获取群主/管理员列表
sourcepub async fn group_sign_in(&self, group_code: i64) -> RQResult<()>
pub async fn group_sign_in(&self, group_code: i64) -> RQResult<()>
群聊打卡
sourceimpl Client
impl Client
登录相关
sourcepub async fn fetch_qrcode(&self) -> RQResult<QRCodeState>
pub async fn fetch_qrcode(&self) -> RQResult<QRCodeState>
二维码登录 - 获取二维码
sourcepub async fn query_qrcode_result(&self, sig: &[u8]) -> RQResult<QRCodeState>
pub async fn query_qrcode_result(&self, sig: &[u8]) -> RQResult<QRCodeState>
二维码登录 - 查询二维码状态
sourcepub async fn qrcode_login(
&self,
tmp_pwd: &[u8],
tmp_no_pic_sig: &[u8],
tgt_qr: &[u8]
) -> RQResult<LoginResponse>
pub async fn qrcode_login(
&self,
tmp_pwd: &[u8],
tmp_no_pic_sig: &[u8],
tgt_qr: &[u8]
) -> RQResult<LoginResponse>
二维码登录 - 登录 ( 可能还需要 device_lock_login )
sourcepub async fn password_md5_login(
&self,
uin: i64,
password_md5: &[u8]
) -> RQResult<LoginResponse>
pub async fn password_md5_login(
&self,
uin: i64,
password_md5: &[u8]
) -> RQResult<LoginResponse>
密码登录 - 提交密码md5
pub async fn password_login(
&self,
uin: i64,
password: &str
) -> RQResult<LoginResponse>
sourcepub async fn request_sms(&self) -> RQResult<LoginResponse>
pub async fn request_sms(&self) -> RQResult<LoginResponse>
密码登录 - 请求短信验证码
sourcepub async fn submit_sms_code(&self, code: &str) -> RQResult<LoginResponse>
pub async fn submit_sms_code(&self, code: &str) -> RQResult<LoginResponse>
密码登录 - 提交短信验证码
sourcepub async fn submit_ticket(&self, ticket: &str) -> RQResult<LoginResponse>
pub async fn submit_ticket(&self, ticket: &str) -> RQResult<LoginResponse>
密码登录 - 提交滑块ticket
sourcepub async fn device_lock_login(&self) -> RQResult<LoginResponse>
pub async fn device_lock_login(&self) -> RQResult<LoginResponse>
设备锁登录 - 二维码、密码登录都需要
sourcepub async fn token_login(&self, token: Token) -> RQResult<LoginResponse>
pub async fn token_login(&self, token: Token) -> RQResult<LoginResponse>
token 登录
sourcepub async fn request_change_sig(
&self,
main_sig_map: Option<u32>
) -> RQResult<LoginResponse>
pub async fn request_change_sig(
&self,
main_sig_map: Option<u32>
) -> RQResult<LoginResponse>
换 token,使用后需要重新 register
sourcepub async fn register_client(&self) -> RQResult<SvcRespRegister>
pub async fn register_client(&self) -> RQResult<SvcRespRegister>
注册客户端,登录后必须注册
pub async fn heartbeat(&self) -> RQResult<()>
sourceimpl Client
impl Client
API
sourcepub async fn update_online_status<T>(&self, status: T) -> RQResult<()> where
T: Into<Status>,
pub async fn update_online_status<T>(&self, status: T) -> RQResult<()> where
T: Into<Status>,
设置在线状态 TODO net_type
sourcepub async fn update_signature(&self, signature: String) -> RQResult<()>
pub async fn update_signature(&self, signature: String) -> RQResult<()>
修改签名
sourcepub async fn update_profile_detail(
&self,
profile: ProfileDetailUpdate
) -> RQResult<()>
pub async fn update_profile_detail(
&self,
profile: ProfileDetailUpdate
) -> RQResult<()>
修改个人资料
sourcepub async fn refresh_status(&self) -> RQResult<()>
pub async fn refresh_status(&self) -> RQResult<()>
刷新客户端状态
sourcepub async fn get_allowed_clients(&self) -> RQResult<Vec<SvcDevLoginInfo>>
pub async fn get_allowed_clients(&self) -> RQResult<Vec<SvcDevLoginInfo>>
获取通过安全验证的设备
sourcepub async fn translate(
&self,
src_language: String,
dst_language: String,
src_text_list: Vec<String>
) -> RQResult<Vec<String>>
pub async fn translate(
&self,
src_language: String,
dst_language: String,
src_text_list: Vec<String>
) -> RQResult<Vec<String>>
文本翻译
pub async fn send_like(
&self,
uin: i64,
count: i32,
source: i32,
cookies: Bytes
) -> RQResult<()>
pub async fn image_ocr(
&self,
img_url: String,
md5: String,
size: i32,
wight: i32,
height: i32
) -> RQResult<OcrResponse>
pub async fn delete_message(&self, items: Vec<MessageItem>) -> RQResult<()>
pub async fn delete_online_push(
&self,
uin: i64,
svrip: i32,
push_token: Bytes,
seq: u16,
del_msg: Vec<PushMessageInfo>
) -> RQResult<()>
pub async fn get_summary_info(&self, uin: i64) -> RQResult<SummaryCardInfo>
pub async fn upload_msgs(
&self,
group_code: i64,
msgs: Vec<ForwardMessage>,
is_long: bool
) -> RQResult<String>
pub async fn download_msgs(
&self,
res_id: String
) -> RQResult<Vec<ForwardMessage>>
sourcepub async fn send_message(
&self,
routing_head: RoutingHead,
message_chain: MessageChain,
ptt: Option<Ptt>
) -> RQResult<MessageReceipt>
pub async fn send_message(
&self,
routing_head: RoutingHead,
message_chain: MessageChain,
ptt: Option<Ptt>
) -> RQResult<MessageReceipt>
发送消息
sourceimpl Client
impl Client
pub async fn highway_upload_bdh(
&self,
addr: SocketAddr,
input: BdhInput
) -> RQResult<Bytes>
sourceimpl Client
impl Client
pub fn get_address(&self) -> SocketAddr
pub fn get_status(&self) -> u8
pub async fn start<S: AsyncRead + AsyncWrite>(self: &Arc<Self>, stream: S)
pub fn stop(&self, status: NetworkStatus)
sourceimpl Client
impl Client
pub fn new<H>(device: Device, version: &'static Version, handler: H) -> Client where
H: Handler + 'static + Sync + Send,
pub fn new_with_config<H>(config: Config, handler: H) -> Self where
H: Handler + 'static + Sync + Send,
pub async fn uin(&self) -> i64
pub async fn send(&self, pkt: Packet) -> RQResult<usize>
pub async fn send_and_wait(&self, pkt: Packet) -> RQResult<Packet>
pub async fn do_heartbeat(&self)
pub async fn gen_token(&self) -> Token
pub async fn load_token(&self, token: Token)
pub async fn device(&self) -> Device
pub async fn version(&self) -> Version
pub async fn _get_highway_session_key(&self) -> Vec<u8>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more