[−][src]Struct spectacles_rest::RestClient
The Main client which is used to interface with the various components of the Discord API.
Fields
token: String
The bot token for this user.
base_url: String
The base URL of the client. This may be changed to accomodate an external proxy system.
http: ReqwestClient
Methods
impl RestClient
[src]
pub fn new(token: String, using_ratelimiter: bool) -> Self
[src]
Creates a new REST client with the provided configuration. The second argument denotes whether or not to use the built-in rate limiter to rate limit requests to the Discord API. If you plan to use a distributed architecture, you will need an external ratelimiter to ensure ratelimis are kept across servers.
pub fn set_proxy(self, url: String) -> Self
[src]
Enables support for routing all requests though an HTTP rate limiting proxy. If you plan on making distributed REST requests, an HTTP proxy is recommended for handling rate limits in a distributed manner.
pub fn channel(&self, id: &Snowflake) -> ChannelView
[src]
Opens a ChannelView for the provided Channel snowflake.
pub fn guild(&self, id: &Snowflake) -> GuildView
[src]
Opens a GuildView for the provided Guild snowflake.
pub fn webhook(&self, id: &Snowflake) -> WebhookView
[src]
Opens a WebhookView for the provided Webhook snowflake.
pub fn get_user(
&self,
id: &Snowflake
) -> impl Future<Item = User, Error = Error>
[src]
&self,
id: &Snowflake
) -> impl Future<Item = User, Error = Error>
Gets a User object for the provided snowflake.
pub fn create_dm(
&self,
user: &Snowflake
) -> impl Future<Item = Channel, Error = Error>
[src]
&self,
user: &Snowflake
) -> impl Future<Item = Channel, Error = Error>
Opens a new DM channel with the user at the provided user ID.
pub fn create_guild(
&self,
opts: CreateGuildOptions
) -> impl Future<Item = Guild, Error = Error>
[src]
&self,
opts: CreateGuildOptions
) -> impl Future<Item = Guild, Error = Error>
Creates a new guild, setting the current client user as owner. This endpoint may only be used for bots who are in less than 10 guilds.
pub fn leave_guild(
&self,
id: &Snowflake
) -> impl Future<Item = (), Error = Error>
[src]
&self,
id: &Snowflake
) -> impl Future<Item = (), Error = Error>
Leaves the guild using the provided guild ID.
pub fn get_voice_regions(
&self
) -> impl Future<Item = Vec<VoiceRegion>, Error = Error>
[src]
&self
) -> impl Future<Item = Vec<VoiceRegion>, Error = Error>
Modifies properties for the current user. Obtains a list of Discord voice regions.
pub fn get_invite(
&self,
code: &str,
member_counts: bool
) -> impl Future<Item = Invite, Error = Error>
[src]
&self,
code: &str,
member_counts: bool
) -> impl Future<Item = Invite, Error = Error>
Obtains an invite object from Discord using the given code. The second argument denotes whether the invite should contain approximate member counts
pub fn delete_invite(
&self,
code: &str
) -> impl Future<Item = Invite, Error = Error>
[src]
&self,
code: &str
) -> impl Future<Item = Invite, Error = Error>
Deletes this invite from the its parent channel.
This requires that the client have the MANAGE_CHANNELS
permission.
pub fn request<T>(
&self,
endpt: Endpoint
) -> Box<dyn Future<Item = T, Error = Error> + Send> where
T: DeserializeOwned + Send + 'static,
[src]
&self,
endpt: Endpoint
) -> Box<dyn Future<Item = T, Error = Error> + Send> where
T: DeserializeOwned + Send + 'static,
Makes an HTTP request to the provided Discord API endpoint. Depending on the ratelimiter status, the request may or may not be rate limited.
pub fn request_empty(
&self,
endpt: Endpoint
) -> Box<dyn Future<Item = (), Error = Error> + Send>
[src]
&self,
endpt: Endpoint
) -> Box<dyn Future<Item = (), Error = Error> + Send>
Similar to the above method, but does not attempt to deserialize a JSON payload from the request. Use this method if you are dealing with routes that return 204 (No content).
Trait Implementations
impl Clone for RestClient
[src]
fn clone(&self) -> RestClient
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for RestClient
[src]
Auto Trait Implementations
impl Send for RestClient
impl Sync for RestClient
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Erased for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
U: TryFrom<T>,