Struct boticordrs::BoticordClient
source · [−]pub struct BoticordClient { /* private fields */ }
Expand description
You can use it to make it much easier to use the Boticord API.
Implementations
sourceimpl BoticordClient
impl BoticordClient
sourcepub fn new(token: String, version: u64) -> Result<Self, BoticordError>
pub fn new(token: String, version: u64) -> Result<Self, BoticordError>
Constructs a new Client.
In BotiCord API v2 there are some changes with token. Read more here
Arguments
token
- Your BotiCord tokenversion
- Version of BotiCord API.
sourcepub fn new_with_client(
client: ReqwestClient,
token: String,
version: u64
) -> Self
pub fn new_with_client(
client: ReqwestClient,
token: String,
version: u64
) -> Self
Constructs a new Client with ReqwestClient specified by user.
In BotiCord API v2 there are some changes with token. Read more here
Arguments
client
- Your custom ReqwestClienttoken
- Your BotiCord tokenversion
- Version of BotiCord API
sourcepub async fn get_bot_info(&self, bot: String) -> Result<Bot, BoticordError>
pub async fn get_bot_info(&self, bot: String) -> Result<Bot, BoticordError>
sourcepub async fn get_server_info(
&self,
server: String
) -> Result<Server, BoticordError>
pub async fn get_server_info(
&self,
server: String
) -> Result<Server, BoticordError>
sourcepub async fn get_user_info(
&self,
user: String
) -> Result<UserInformation, BoticordError>
pub async fn get_user_info(
&self,
user: String
) -> Result<UserInformation, BoticordError>
sourcepub async fn get_bot_comments(
&self,
bot: String
) -> Result<Vec<SingleComment>, BoticordError>
pub async fn get_bot_comments(
&self,
bot: String
) -> Result<Vec<SingleComment>, BoticordError>
sourcepub async fn get_server_comments(
&self,
server: String
) -> Result<Vec<SingleComment>, BoticordError>
pub async fn get_server_comments(
&self,
server: String
) -> Result<Vec<SingleComment>, BoticordError>
sourcepub async fn get_user_comments(
&self,
user: String
) -> Result<UserComments, BoticordError>
pub async fn get_user_comments(
&self,
user: String
) -> Result<UserComments, BoticordError>
sourcepub async fn get_user_bots(
&self,
user: String
) -> Result<Vec<SingleUserBot>, BoticordError>
pub async fn get_user_bots(
&self,
user: String
) -> Result<Vec<SingleUserBot>, BoticordError>
sourcepub async fn get_my_shorted_links(
&self
) -> Result<Vec<ShortedLink>, BoticordError>
pub async fn get_my_shorted_links(
&self
) -> Result<Vec<ShortedLink>, BoticordError>
Get Vec of shorted by current user links
sourcepub async fn search_for_shorted_link(
&self,
shortener_body: ShortenerBody
) -> Result<Vec<ShortedLink>, BoticordError>
pub async fn search_for_shorted_link(
&self,
shortener_body: ShortenerBody
) -> Result<Vec<ShortedLink>, BoticordError>
Get Vec of shorted by current user links with the provided code
Arguments
shortener_body
- Short information about a link, that we will search.
sourcepub async fn create_shorted_link(
&self,
shortener_body: ShortenerBody
) -> Result<ShortedLink, BoticordError>
pub async fn create_shorted_link(
&self,
shortener_body: ShortenerBody
) -> Result<ShortedLink, BoticordError>
sourcepub async fn delete_shorted_link(
&self,
shortener_body: ShortenerBody
) -> Result<(), BoticordError>
pub async fn delete_shorted_link(
&self,
shortener_body: ShortenerBody
) -> Result<(), BoticordError>
sourcepub async fn post_bot_stats(&self, stats: BotStats) -> Result<(), BoticordError>
pub async fn post_bot_stats(&self, stats: BotStats) -> Result<(), BoticordError>
Post current bot’s stats.
How to set BotStats? (example)
Arguments
stats
- Stats that we will post
Examples
use boticordrs::types::{BotStats};
let stats = BotStats{servers: 2514, shards: 3, users: 338250};
sourcepub async fn post_server_stats(
&self,
stats: ServerStats
) -> Result<(), BoticordError>
pub async fn post_server_stats(
&self,
stats: ServerStats
) -> Result<(), BoticordError>
Post Server Stats Method.
Remember, that only Boticord-Service Bots can do it in global, other will get an 403 error. (but it may works for custom bots, but you need a special API-token)
Arguments
stats
- Stats that we will post
Trait Implementations
sourceimpl Clone for BoticordClient
impl Clone for BoticordClient
sourcefn clone(&self) -> BoticordClient
fn clone(&self) -> BoticordClient
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for BoticordClient
impl Send for BoticordClient
impl Sync for BoticordClient
impl Unpin for BoticordClient
impl !UnwindSafe for BoticordClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more