[][src]Struct discord_bots_org::bridge::reqwest::sync::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::ReqwestSyncClient;

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::ReqwestSyncClient as ApiClient;
use reqwest::Client as ReqwestClient;
use std::sync::Arc;

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

pub fn get_bot(&self, user_id: u64) -> Result<Bot>
[src]

Retrieves information about a bot.

pub fn get_bots<F>(&self, search: F) -> Result<SearchResponse<Bot>> where
    F: FnOnce(BotSearch) -> BotSearch
[src]

Retrieves a list of bots via a search.

pub fn get_bot_stats(&self, user_id: u64) -> Result<BotStats>
[src]

Retrieves information about a bot's specific stats.

pub fn get_bot_vote_check(
    &self,
    auth: impl AsRef<str>,
    bot_id: u64,
    user_id: u64
) -> Result<bool>
[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 fn get_bot_votes(
    &self,
    auth: impl AsRef<str>,
    bot_id: u64
) -> Result<BotVotes>
[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 fn get_user(&self, user_id: u64) -> Result<User>
[src]

Retrieves information about a user.

pub fn post_stats(
    &self,
    auth: impl AsRef<str>,
    bot_id: u64,
    stats: &ShardStats
) -> Result<()>
[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> From for T
[src]

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, 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> BorrowMut for T where
    T: ?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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T