Skip to main content

hey_sdk/generated/services/
identity.rs

1// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
2
3#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]
4
5use crate::client::Client;
6use crate::error::Error;
7use crate::generated::routes;
8use crate::generated::types::*;
9
10pub struct Identity<'a> {
11    client: &'a Client,
12}
13
14impl<'a> Identity<'a> {
15    pub(crate) fn new(client: &'a Client) -> Self {
16        Self { client }
17    }
18
19    /// The client this service sends through.
20    pub fn client(&self) -> &'a Client {
21        self.client
22    }
23
24    /// Get the current identity (authenticated user profile)
25    pub async fn get(&self) -> Result<GetIdentityResponseContent, Error> {
26        let operation = self.client.operation(&routes::GET_IDENTITY, &[]);
27        self.client.send(operation).await
28    }
29
30    /// Get navigation items
31    pub async fn get_navigation(&self) -> Result<GetNavigationResponseContent, Error> {
32        let operation = self.client.operation(&routes::GET_NAVIGATION, &[]);
33        self.client.send(operation).await
34    }
35
36    /// Set which day the identity's calendar weeks start on. Answers the stored
37    /// preference. The write reaches every HEY client — web, mobile and this SDK
38    /// read the same identity preference.
39    pub async fn update_first_week_day(
40        &self,
41        body: &UpdateFirstWeekDayRequestContent,
42    ) -> Result<UpdateFirstWeekDayResponseContent, Error> {
43        let mut operation = self.client.operation(&routes::UPDATE_FIRST_WEEK_DAY, &[]);
44        operation.json(body)?;
45        self.client.send(operation).await
46    }
47
48    /// Set whether HEY renders times on a 12-hour or a 24-hour clock. Answers the
49    /// stored preference. The parameter is the web toggle's, said honestly: true
50    /// for the 24-hour clock, false for the 12-hour one.
51    pub async fn update_time_format(
52        &self,
53        body: &UpdateTimeFormatRequestContent,
54    ) -> Result<UpdateTimeFormatResponseContent, Error> {
55        let mut operation = self.client.operation(&routes::UPDATE_TIME_FORMAT, &[]);
56        operation.json(body)?;
57        self.client.send(operation).await
58    }
59}