Skip to main content

User

Struct User 

Source
pub struct User {
    pub chatroom: ChatRoom,
    pub chat: Chat,
    pub breezemoon: BreezeMoon,
    pub article: Article,
    pub notice: Notice,
    pub redpacket: Redpacket,
    pub comment: Comment,
    /* private fields */
}

Fields§

§chatroom: ChatRoom§chat: Chat§breezemoon: BreezeMoon§article: Article§notice: Notice§redpacket: Redpacket§comment: Comment

Implementations§

Source§

impl User

Source

pub fn new(api_key: String) -> Self

Source

pub fn get_token(&self) -> &str

Source

pub fn set_token(&mut self, token: String)

重新设置请求token

Source

pub fn is_logined(&self) -> bool

Source

pub async fn info(&self) -> Result<UserInfo, Error>

返回登录账户信息,需要先登录或设置有效api_key

Source

pub async fn emotions(&self) -> Result<Vec<String>, Error>

查询登录用户常用表情

Source

pub async fn liveness(&self) -> Result<u32, Error>

查询登录用户当前活跃度,请求频率请至少 10 分钟一次

Source

pub async fn is_checkin(&self) -> Result<bool, Error>

检查用户是否已经签到

Source

pub async fn is_collected_liveness(&self) -> Result<bool, Error>

检查用户是否领取昨日活跃奖励

Source

pub async fn reward_liveness(&self) -> Result<u32, Error>

领取昨日活跃度奖励

Source

pub async fn transfer( &self, username: &str, amount: u32, memo: &str, ) -> Result<bool, Error>

转账

Source

pub async fn follow(&self, following_id: &str) -> Result<bool, Error>

关注用户

Source

pub async fn unfollow(&self, following_id: &str) -> Result<bool, Error>

取消关注用户

Source

pub async fn update_avatar(&self, avatar_url: &str) -> Result<bool, Error>

修改用户头像

Source

pub async fn update_user_info( &self, params: UpdateUserInfoParams, ) -> Result<bool, Error>

修改用户信息

§参数
Source

pub async fn get_user(&self, username: &str) -> Result<UserInfo, Error>

获取用户信息

  • username 用户名

返回用户信息

Source

pub async fn report(&self, data: &Report) -> Result<ResponseResult, Error>

举报

返回举报结果

Source

pub async fn upload(&self, files: Vec<String>) -> Result<UploadResult, Error>

上传文件

  • files 文件路径列表

返回上传结果

Source

pub async fn get_points(&self, username: &str) -> Result<UserPoint, Error>

获取用户积分

  • username 用户名 返回用户积分信息 UserPoint

Auto Trait Implementations§

§

impl Freeze for User

§

impl !RefUnwindSafe for User

§

impl Send for User

§

impl Sync for User

§

impl Unpin for User

§

impl UnsafeUnpin for User

§

impl !UnwindSafe for User

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more