Struct Client

Source
pub struct Client {
    pub appid: String,
    pub secret: String,
    pub client: Client,
    pub access_token: Option<AccessToken>,
}

Fields§

§appid: String§secret: String§client: Client§access_token: Option<AccessToken>

Implementations§

Source§

impl Client

Source

pub async fn code2session( &self, js_code: &str, ) -> Result<Code2Session, MiniProgramError>

Source

pub async fn check_session_key( &self, open_id: &str, signature: &str, ) -> Result<(), MiniProgramError>

Source

pub async fn reset_user_session_key( &self, open_id: &str, signature: &str, ) -> Result<SessionKey, MiniProgramError>

Source§

impl Client

Source§

impl Client

Source

pub async fn crop_image( &self, path: &str, ) -> Result<CropImage, MiniProgramError>

Source

pub async fn scan_qrcode( &self, path: &str, ) -> Result<ScanQrcode, MiniProgramError>

Source§

impl Client

Source

pub async fn get_user_encrypt_key( &self, openid: &str, signature: &str, ) -> Result<Keys, MiniProgramError>

Source§

impl Client

Source

pub async fn common_ocr(&self, path: &str) -> Result<CommOcr, MiniProgramError>

Source

pub async fn driving(&self, path: &str) -> Result<Driving, MiniProgramError>

Source

pub async fn bank_card(&self, path: &str) -> Result<BankCard, MiniProgramError>

Source

pub async fn biz_license( &self, path: &str, ) -> Result<BizLicense, MiniProgramError>

Source

pub async fn driving_license( &self, path: &str, ) -> Result<DrivingLicense, MiniProgramError>

Source

pub async fn id_card(&self, path: &str) -> Result<IdCard, MiniProgramError>

Source§

impl Client

Source

pub async fn clear_quota(&self) -> Result<(), MiniProgramError>

Source

pub async fn clear_quota_by_app_secret(&self) -> Result<(), MiniProgramError>

Source

pub async fn get_api_quota( &self, api_path: &str, ) -> Result<ApiQuota, MiniProgramError>

Source

pub async fn get_rid_info(&self, rid: &str) -> Result<RidInfo, MiniProgramError>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub async fn get_service_message_media( &self, media_id: &str, ) -> Result<Media, MiniProgramError>

Source

pub async fn send_service_message_typing( &self, openid: &str, command: Command, ) -> Result<(), MiniProgramError>

Source

pub async fn upload_media( &self, file_path: &str, ) -> Result<(), MiniProgramError>

Source

pub async fn send_service_message( &self, request: &ServiceMessageRequest, ) -> Result<(), MiniProgramError>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub async fn get_plugin_open_pid( &self, code: &str, ) -> Result<PluginOpenPid, MiniProgramError>

Source

pub async fn check_encrypted_msg( &self, encrypted_msg_hash: &str, ) -> Result<CheckEncryptedMsg, MiniProgramError>

Source

pub async fn get_paid_unionid_by_transaction( &self, openid: &str, transaction_id: &str, ) -> Result<PaidUnionid, MiniProgramError>

Source

pub async fn get_paid_unionid_by_trade_no( &self, openid: &str, mch_id: &str, out_trade_no: &str, ) -> Result<PaidUnionid, MiniProgramError>

Source§

impl Client

Source

pub fn new(appid: &str, secret: &str) -> Self

Trait Implementations§

Source§

impl ClientTrait for Client

Source§

async fn access_token(&self) -> Result<String>

Source§

async fn refresh_access_token(&mut self) -> Result<()>

Source§

fn http_client(&self) -> &Client

Source§

fn url_with_query<I, K, V>( &self, url: &str, queries: I, ) -> Result<Url, WechatError>
where I: IntoIterator, <I as IntoIterator>::Item: Borrow<(K, V)>, K: AsRef<str>, V: AsRef<str>,

Source§

fn authorized_url( &self, url: &str, ) -> impl Future<Output = Result<Url, WechatError>> + Send
where Self: Sync,

Source§

fn get_empty<R, U>( &self, url: U, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, Self: Sync,

Source§

fn get<R, U, T>( &self, url: U, query: &T, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + Sync + ?Sized, Self: Sync,

Source§

fn post_empty<R, U>( &self, url: U, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, Self: Sync,

Source§

fn post<R, U, T>( &self, url: U, data: &T, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + Sync + ?Sized, Self: Sync,

Source§

fn upload<R, U>( &self, url: U, multipart: Form, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, Self: Sync,

Source§

fn upload_with<R, U, T>( &self, url: U, data: &T, multipart: Form, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + Sync + ?Sized, Self: Sync,

Source§

fn json<R, U, T>( &self, url: U, data: &T, ) -> impl Future<Output = Result<R, WechatError>> + Send
where R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + Sync + ?Sized, Self: Sync,

Source§

fn download<U, T>( &self, url: U, query: &T, ) -> impl Future<Output = Result<Vec<u8>, WechatError>> + Send
where U: IntoUrl + Send, T: Serialize + Sync + ?Sized, Self: Sync,

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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<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
Source§

impl<T> ErasedDestructor for T
where T: 'static,