aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDankDumpster <[email protected]>2021-01-15 04:17:43 +0100
committerDankDumpster <[email protected]>2021-01-15 04:17:43 +0100
commite4425e092962588823839011c92b4894fa963a07 (patch)
treeeed4e007522e136846e148e21b0697dc6e36c135
parentupdate documentation (diff)
downloadoauth-reqwest-support.tar.xz
oauth-reqwest-support.zip
added preludereqwest-support
-rw-r--r--examples/rocket.rs3
-rw-r--r--src/bridge/reqwest.rs9
-rw-r--r--src/lib.rs9
3 files changed, 12 insertions, 9 deletions
diff --git a/examples/rocket.rs b/examples/rocket.rs
index 13050ce..dd8e475 100644
--- a/examples/rocket.rs
+++ b/examples/rocket.rs
@@ -25,8 +25,7 @@
extern crate rocket;
use rocket::response::Redirect;
-use serenity_oauth::model::AccessTokenExchangeRequest;
-use serenity_oauth::{DiscordOAuthReqwestRequester, Scope};
+use serenity_oauth::prelude::*;
use std::env;
use std::error::Error;
diff --git a/src/bridge/reqwest.rs b/src/bridge/reqwest.rs
index 971d594..fc313b6 100644
--- a/src/bridge/reqwest.rs
+++ b/src/bridge/reqwest.rs
@@ -18,17 +18,14 @@ use serde_urlencoded;
/// the instance of hyper's Client will have those methods available:
///
/// ```rust,no_run
-/// extern crate hyper;
-/// extern crate serenity_oauth;
-///
/// # fn main() {
-/// use hyper::Client;
+/// use reqwest::blocking::Client;
///
/// let client = Client::new();
///
/// // At this point, the methods defined by the trait are not in scope. By
/// // using the trait, they will be.
-/// use serenity_oauth::DiscordOAuthHyperRequester;
+/// use serenity_oauth::DiscordOAuthReqwestRequester;
///
/// // The methods defined by `DiscordOAuthHyperRequester` are now in scope and
/// // implemented on the instance of hyper's `Client`.
@@ -112,7 +109,7 @@ impl DiscordOAuthReqwestRequester for ReqwestClient {
fn exchange_code(&self, request: &AccessTokenExchangeRequest) -> Result<AccessTokenResponse> {
let body = serde_urlencoded::to_string(request)?;
- let response = sel
+ let response = self
.post(BASE_TOKEN_URI)
.header(CONTENT_TYPE, "application/x-www-form-urlencoded")
.body(body)
diff --git a/src/lib.rs b/src/lib.rs
index 9d96bd3..d1a592d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,3 @@
-#![warn(missing_docs)]
//! # serenity-oauth
//!
//! `serenity-oauth` is a collection of HTTP library support bridges for
@@ -39,3 +38,11 @@ pub use bridge::hyper::DiscordOAuthHyperRequester;
pub use bridge::reqwest::DiscordOAuthReqwestRequester;
pub use error::{Error, Result};
pub use scope::Scope;
+
+#[allow(missing_docs)]
+pub mod prelude {
+ pub use crate::bridge::hyper::DiscordOAuthHyperRequester;
+ pub use crate::bridge::reqwest::DiscordOAuthReqwestRequester;
+ pub use crate::model::*;
+ pub use crate::scope::Scope;
+}