ChmlApi

Struct ChmlApi 

Source
pub struct ChmlApi {
    pub base_url: String,
    pub token: Option<String>,
    pub client: Client,
}
Expand description

如果token能统一位置就好了,可以更抽象和简化,一般都用 Authorization: Bearer 这种形式

Fields§

§base_url: String§token: Option<String>§client: Client

Implementations§

Source§

impl ChmlApi

Source

pub async fn list_available_domains(&self) -> ApiResult<Vec<Domain>>

get available domains

Source

pub async fn get_user_free_domains(&self) -> ApiResult<Vec<UserDomain>>

get user free domains

Source

pub async fn create_free_subdomain( &self, params: &CreateDomainParams, ) -> ApiResult<()>

create free subdomain

Source

pub async fn delete_free_subdomain( &self, domain: &str, record: &str, ) -> ApiResult<()>

delete free subdomain

Source

pub async fn update_free_subdomain( &self, params: &CreateDomainParams, ) -> ApiResult<()>

update free subdomain

Source§

impl ChmlApi

Source

pub async fn node(&self) -> ApiResult<Vec<Node>>

node list

Source

pub async fn nodeinfo(&self, node_name: &str) -> ApiResult<NodeInfo>

node detail

Source

pub async fn node_stats(&self) -> ApiResult<Vec<NodeStats>>

node stats

Source

pub async fn node_uptime( &self, node_name: &str, days: i32, ) -> ApiResult<Vec<NodeUptime>>

node uptime

Source

pub async fn node_status(&self, node_name: &str) -> ApiResult<NodeStatusResult>

node status

Source§

impl ChmlApi

Source

pub async fn panelinfo(&self) -> ApiResult<PanelInfo>

panel info

Source

pub async fn server_status(&self) -> Result<ServerMetrics, ApiError>

server_status

Source§

impl ChmlApi

Source

pub async fn tunnel(&self) -> ApiResult<Vec<Tunnel>>

get_tunnels

Source

pub async fn create_tunnel( &self, params: &CreateTunnelParams, ) -> ApiResult<Tunnel>

create_tunnel

Source

pub async fn delete_tunnel(&self, tunnel_id: &str) -> ApiResult<()>

delete_tunnel

Source

pub async fn update_tunnel( &self, tunnel_update: TunnelUpdate, ) -> ApiResult<Tunnel>

update_tunnel

Source

pub async fn tunnel_config( &self, node: &str, tunnel_names: &[&str], ) -> ApiResult<String>

tunnel_config

Source§

impl ChmlApi

Source

pub async fn login(&mut self, login_params: &LoginParams) -> ApiResult<UserInfo>

login & set token

Source

pub async fn send_email_code( &self, sec_params: &SendEmailCodeParams, ) -> ApiResult<()>

send email code

Source

pub async fn register(&self, register_params: &RegisterParams) -> ApiResult<()>

register

Source

pub async fn user_info(&self) -> ApiResult<UserInfo>

user info

Source

pub async fn retoken( &self, reset_token_params: &ResetTokenParams, ) -> ApiResult<()>

retoken

Source

pub async fn qiandao(&self, checkin_params: &CheckinParams) -> ApiResult<()>

qiandao

Source

pub async fn reset_password( &self, reset_password_params: &ResetPasswordParams, ) -> ApiResult<()>

reset_password

Source

pub async fn update_username(&self, new_username: &str) -> ApiResult<()>

update_username

Source

pub async fn update_qq(&self, new_qq: &str) -> ApiResult<()>

update_qq

Source

pub async fn update_userimg(&self, new_user_img_url: &str) -> ApiResult<()>

update_userimg

Source§

impl ChmlApi

Source

pub async fn get_user_logs( &self, page: i32, size: i32, ) -> ApiResult<UserLogsResult>

user logs

Source

pub async fn get_messages( &self, page: i32, size: i32, priority: i32, ) -> ApiResult<MessagesResult>

messages

Source§

impl ChmlApi

Source

pub fn new(base_url: &str) -> Self

Source

pub fn from_env() -> Result<Self, VarError>

Source

pub fn new_with_token(base_url: &str, token: &str) -> Self

Source

pub fn endpoint(&self, path: &str) -> String

Source

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

Source

pub fn get_token(&self) -> Result<&str, ApiError>

Auto Trait Implementations§

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, 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<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