hevy 0.1.0

An async Rust client library for the Hevy public API (https://api.hevyapp.com/docs/)
Documentation
use crate::client::HevyClient;
use crate::error::Result;
use crate::models::{CreateRoutineFolderRequest, RoutineFolder, RoutineFoldersPage};

impl HevyClient {
    /// Gets a paginated list of routine folders available on the account.
    ///
    /// `page` must be 1 or greater (defaults to `1`). `page_size` is capped at 10
    /// by the API (defaults to `5`).
    pub async fn list_routine_folders(
        &self,
        page: Option<u32>,
        page_size: Option<u32>,
    ) -> Result<RoutineFoldersPage> {
        self.get(
            "/v1/routine_folders",
            &[
                ("page", page.map(|p| p.to_string())),
                ("pageSize", page_size.map(|p| p.to_string())),
            ],
        )
        .await
    }

    /// Gets a single routine folder by id.
    pub async fn get_routine_folder(&self, folder_id: &str) -> Result<RoutineFolder> {
        self.get(&format!("/v1/routine_folders/{folder_id}"), &[])
            .await
    }

    /// Creates a new routine folder.
    ///
    /// The folder is created at index 0; all other folders have their indexes
    /// incremented.
    pub async fn create_routine_folder(
        &self,
        request: &CreateRoutineFolderRequest,
    ) -> Result<RoutineFolder> {
        self.post("/v1/routine_folders", request).await
    }
}