modio/request/auth/
get_terms.rs

1use std::future::IntoFuture;
2
3use crate::client::Client;
4use crate::request::{Output, RequestBuilder, Route};
5use crate::response::ResponseFuture;
6use crate::types::auth::Terms;
7
8/// Retrieve texts and links for a users agreement and consent.
9pub struct GetTerms<'a> {
10    http: &'a Client,
11}
12
13impl<'a> GetTerms<'a> {
14    pub(crate) const fn new(http: &'a Client) -> Self {
15        Self { http }
16    }
17}
18
19impl IntoFuture for GetTerms<'_> {
20    type Output = Output<Terms>;
21    type IntoFuture = ResponseFuture<Terms>;
22
23    fn into_future(self) -> Self::IntoFuture {
24        let route = Route::Terms;
25        match RequestBuilder::from_route(&route).empty() {
26            Ok(req) => self.http.request(req),
27            Err(err) => ResponseFuture::failed(err),
28        }
29    }
30}