basecamp-sdk 0.26.0

Official client for Basecamp - https://basecamp.com
Documentation
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

//! HillCharts operations.

#![allow(
    clippy::too_many_arguments,
    clippy::wildcard_imports,
    clippy::doc_markdown
)]

use crate::client::AccountClient;
use crate::error::Error;
use crate::generated::routes;
#[allow(unused_imports)]
use crate::generated::types::*;

/// `HillCharts` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct HillChartsService<'a> {
    client: &'a AccountClient,
}

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

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

    /// Get the hill chart for a todoset
    ///
    /// `GET /todosets/{todosetId}/hill.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn get(&self, todoset_id: i64) -> Result<GetHillChartResponseContent, Error> {
        let operation = self
            .client
            .operation(&routes::GET_HILL_CHART, &[&todoset_id]);
        self.client.send(operation).await
    }

    /// Track or untrack todolists on a hill chart
    ///
    /// `PUT /todosets/{todosetId}/hills/settings.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn update_settings(
        &self,
        todoset_id: i64,
        body: &UpdateHillChartSettingsRequestContent,
    ) -> Result<UpdateHillChartSettingsResponseContent, Error> {
        let mut operation = self
            .client
            .operation(&routes::UPDATE_HILL_CHART_SETTINGS, &[&todoset_id]);
        operation.json(body)?;
        self.client.send(operation).await
    }
}