use std::future::IntoFuture;
use crate::client::Client;
use crate::request::{Output, RequestBuilder, Route};
use crate::response::{NoContent, ResponseFuture};
pub struct Logout<'a> {
http: &'a Client,
}
impl<'a> Logout<'a> {
pub(crate) const fn new(http: &'a Client) -> Self {
Self { http }
}
}
impl IntoFuture for Logout<'_> {
type Output = Output<NoContent>;
type IntoFuture = ResponseFuture<NoContent>;
fn into_future(self) -> Self::IntoFuture {
let route = Route::OAuthLogout;
match RequestBuilder::from_route(&route).empty() {
Ok(req) => self.http.request(req),
Err(err) => ResponseFuture::failed(err),
}
}
}