Skip to main content

ipscanner/resources/
gate.rs

1use crate::types::{GateVerification, GateVerifyRequest};
2use crate::{Client, Error};
3
4/// The form gate, server side. Get one with [`Client::gate`].
5#[derive(Debug, Clone, Copy)]
6pub struct Gate<'a> {
7    client: &'a Client,
8}
9
10impl<'a> Gate<'a> {
11    pub(crate) fn new(client: &'a Client) -> Self {
12        Gate { client }
13    }
14
15    /// Redeems a gate token with the site secret. Sent without the API key and never retried.
16    pub async fn verify(&self, req: &GateVerifyRequest) -> Result<GateVerification, Error> {
17        self.client.post_keyless("/gate/verify", req).await
18    }
19}