Run rustfmt
This commit is contained in:
parent
c49f40128d
commit
c1bb3f39f4
|
@ -109,9 +109,7 @@ impl Client {
|
|||
pub fn validate_token(&self, token: &str) -> Result<ValidateTokenResponse, Error> {
|
||||
let endpoint = format!("{}{}", self.api_root_url, Endpoint::ValidateToken);
|
||||
|
||||
let response = attohttpc::get(endpoint)
|
||||
.param("token", token)
|
||||
.send()?;
|
||||
let response = attohttpc::get(endpoint).param("token", token).send()?;
|
||||
|
||||
ResponseType::from_response(response)
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use attohttpc::Response;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Deserialize;
|
||||
use attohttpc::Response;
|
||||
|
||||
use crate::Error;
|
||||
|
||||
|
@ -33,18 +33,30 @@ impl RateLimit {
|
|||
fn from_headers(response: &Response) -> Option<Self> {
|
||||
let headers = response.headers();
|
||||
|
||||
let limit = headers.get("X-RateLimit-Limit")?
|
||||
.to_str().ok()?
|
||||
.parse().ok()?;
|
||||
let remaining = headers.get("X-RateLimit-Remaining")?
|
||||
.to_str().ok()?
|
||||
.parse().ok()?;
|
||||
let reset_in = headers.get("X-RateLimit-Reset-In")?
|
||||
.to_str().ok()?
|
||||
.parse().ok()?;
|
||||
let reset = headers.get("X-RateLimit-Reset")?
|
||||
.to_str().ok()?
|
||||
.parse().ok()?;
|
||||
let limit = headers
|
||||
.get("X-RateLimit-Limit")?
|
||||
.to_str()
|
||||
.ok()?
|
||||
.parse()
|
||||
.ok()?;
|
||||
let remaining = headers
|
||||
.get("X-RateLimit-Remaining")?
|
||||
.to_str()
|
||||
.ok()?
|
||||
.parse()
|
||||
.ok()?;
|
||||
let reset_in = headers
|
||||
.get("X-RateLimit-Reset-In")?
|
||||
.to_str()
|
||||
.ok()?
|
||||
.parse()
|
||||
.ok()?;
|
||||
let reset = headers
|
||||
.get("X-RateLimit-Reset")?
|
||||
.to_str()
|
||||
.ok()?
|
||||
.parse()
|
||||
.ok()?;
|
||||
|
||||
Some(Self {
|
||||
limit,
|
||||
|
|
Loading…
Reference in New Issue