[][src]Struct discord_bots_org::bridge::reqwest::async::Client

pub struct Client { /* fields omitted */ }

Struct which defines the methods necessary to interact with the service.

Examples

To bring in the API client:

use discord_bots_org::bridge::reqwest::r#async::Client;

Methods

impl Client
[src]

pub fn new(reqwest_client: Arc<ReqwestClient>) -> Self
[src]

Creates a new client to interact with the API.

This accepts an existing reqwest Client so a single HTTP client may be shared across your application.

Examples

Create a new API client:

extern crate reqwest;

use discord_bots_org::ReqwestAsyncClient as ApiClient;
use reqwest::r#async::Client as ReqwestClient;
use std::sync::Arc;

let reqwest_client = Arc::new(ReqwestClient::new());
let api_client = ApiClient::new(Arc::clone(&reqwest_client));

pub async fn get_bot(
    &self,
    user_id: u64
) -> impl Future<Output = Result<Bot>> + '_
[src]

Retrieves information about a bot.

pub async fn get_bots<'a>(
    &'a self,
    params: Vec<(&'a str, String)>
) -> impl Future<Output = Result<SearchResponse<Bot>>> + 'a
[src]

Retrieves a list of bots via a search.

pub async fn get_bot_stats(
    &self,
    user_id: u64
) -> impl Future<Output = Result<BotStats>> + '_
[src]

Retrieves information about a bot's specific stats.

pub async fn get_bot_vote_check<'a>(
    &'a self,
    auth: impl AsRef<str> + 'a,
    bot_id: u64,
    user_id: u64
) -> impl Future<Output = Result<bool>> + 'a
[src]

Retrieve whether a user has upvoted a bot in the last 24 hours.

You can use this if your bot has over 1000 votes.

pub async fn get_bot_votes<'a>(
    &'a self,
    auth: impl AsRef<str> + 'a,
    bot_id: u64
) -> impl Future<Output = Result<BotVotes>> + 'a
[src]

Retrieves information to see who has upvoted a bot.

Note: If your bot has over 1000 votes per month, then this can not be used. Webhooks must instead be used.

pub async fn get_user(
    &self,
    user_id: u64
) -> impl Future<Output = Result<User>> + '_
[src]

Retrieves information about a user.

pub async fn post_stats<'a>(
    &'a self,
    auth: impl AsRef<str> + 'a,
    bot_id: u64,
    stats: &'a ShardStats
) -> impl Future<Output = Result<()>> + 'a
[src]

Posts a bot's shard stats.

Trait Implementations

impl Clone for Client
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Client
[src]

Auto Trait Implementations

impl Send for Client

impl Sync for Client

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Erased for T