rive_http/authentication/
onboarding.rs

1use rive_models::{data::CompleteOnboardingData, onboarding::OnboardingStatus};
2
3use crate::prelude::*;
4
5impl Client {
6    /// This will tell you whether the current account requires onboarding or whether you
7    /// can continue to send requests as usual. You may skip calling this if you're restoring
8    /// an existing session.
9    pub async fn check_onboarding_status(&self) -> Result<OnboardingStatus> {
10        Ok(self
11            .client
12            .get(ep!(self, "/onboarding/hello"))
13            .auth(&self.authentication)
14            .send()
15            .await?
16            .process_error()
17            .await?
18            .json()
19            .await?)
20    }
21
22    /// This sets a new username, completes onboarding and allows a user to start using Revolt.
23    pub async fn complete_onboarding(&self, data: CompleteOnboardingData) -> Result<()> {
24        self.client
25            .post(ep!(self, "/onboarding/complete"))
26            .json(&data)
27            .auth(&self.authentication)
28            .send()
29            .await?
30            .process_error()
31            .await?;
32        Ok(())
33    }
34}