hey-sdk 0.30.0

Rust client for the HEY API, generated from a Smithy model of the API
Documentation
// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

#![allow(clippy::too_many_arguments)]

use crate::client::Client;
use crate::error::Error;
use crate::generated::routes;
use crate::generated::types::*;

pub struct Identity<'a> {
    client: &'a Client,
}

impl<'a> Identity<'a> {
    pub(crate) fn new(client: &'a Client) -> Self {
        Self { client }
    }

    /// The client this service sends through.
    pub fn client(&self) -> &'a Client {
        self.client
    }

    /// Get the current identity (authenticated user profile)
    pub async fn get(&self) -> Result<GetIdentityResponseContent, Error> {
        let operation = self.client.operation(&routes::GET_IDENTITY, &[]);
        self.client.send(operation).await
    }

    /// Get navigation items
    pub async fn get_navigation(&self) -> Result<GetNavigationResponseContent, Error> {
        let operation = self.client.operation(&routes::GET_NAVIGATION, &[]);
        self.client.send(operation).await
    }

    /// Set which day the identity's calendar weeks start on. Answers the stored
    /// preference. The write reaches every HEY client — web, mobile and this SDK
    /// read the same identity preference.
    pub async fn update_first_week_day(
        &self,
        body: &UpdateFirstWeekDayRequestContent,
    ) -> Result<UpdateFirstWeekDayResponseContent, Error> {
        let mut operation = self.client.operation(&routes::UPDATE_FIRST_WEEK_DAY, &[]);
        operation.json(body)?;
        self.client.send(operation).await
    }

    /// Set whether HEY renders times on a 12-hour or a 24-hour clock. Answers the
    /// stored preference. The parameter is the web toggle's, said honestly: true
    /// for the 24-hour clock, false for the 12-hour one.
    pub async fn update_time_format(
        &self,
        body: &UpdateTimeFormatRequestContent,
    ) -> Result<UpdateTimeFormatResponseContent, Error> {
        let mut operation = self.client.operation(&routes::UPDATE_TIME_FORMAT, &[]);
        operation.json(body)?;
        self.client.send(operation).await
    }
}