fizzy-sdk 0.2.4

Official Fizzy API client, generated from the Smithy model in spec/
Documentation
// Generated by fizzy-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

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

/// The `Identity` operations.
pub struct IdentityService<'a> {
    scope: Scope<'a>,
}

impl<'a> IdentityService<'a> {
    pub(crate) fn new(scope: Scope<'a>) -> Self {
        Self { scope }
    }

    /// The client and account these operations send through.
    pub fn scope(&self) -> &Scope<'a> {
        &self.scope
    }

    /// `GetMyIdentity` — `GET /my/identity.json`.
    ///
    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
    pub async fn get_my_identity(&self) -> Result<Identity, Error> {
        let operation = self.scope.operation(&routes::GET_MY_IDENTITY, &[])?;
        self.scope.client().send(operation).await
    }

    /// `UpdateMyTimezone` — `PATCH /{accountId}/my/timezone.json`.
    ///
    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
    pub async fn update_my_timezone(
        &self,
        body: &UpdateMyTimezoneRequestContent,
    ) -> Result<(), Error> {
        let mut operation = self.scope.operation(&routes::UPDATE_MY_TIMEZONE, &[])?;
        operation.json(body)?;
        self.scope.client().send_unit(operation).await
    }
}