basecamp-sdk 0.38.0

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

//! BubbleUps 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::*;

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

impl<'a> BubbleUpsService<'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
    }

    /// Bubble up a recording for the current user, resurfacing it in the current
    /// user's readings (the BC5 successor to "save"). Returns 204 No Content with
    /// no body.
    ///
    /// The `at` field controls timing. Send `"now"` to bubble up immediately, or a
    /// scheduling keyword (`"today"`, `"tomorrow"`, `"weekend"`, `"next_week"`) or
    /// an ISO8601 date (e.g. `"2026-09-10"`) to schedule it to resurface later.
    /// NOTE: bc3 currently requires `at` — omitting it raises on the server
    /// (`Date.iso8601(nil)`), so send `"now"` for the immediate case. The field is
    /// modeled optional (not `@required`) so a future bc3 default (`params\[:at\] ||=
    /// "now"`) makes omission mean "now" without an SDK change.
    ///
    /// Idempotent: bubbling up an already-bubbled recording is set-membership and
    /// still returns 204.
    ///
    /// `POST /recordings/{recordingId}/bubble_up.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn create_bubble_up(
        &self,
        recording_id: i64,
        body: &CreateBubbleUpRequestContent,
    ) -> Result<(), Error> {
        let mut operation = self
            .client
            .operation(&routes::CREATE_BUBBLE_UP, &[&recording_id]);
        operation.json(body)?;
        self.client.send_unit(operation).await
    }

    /// Remove the current user's bubble-up from a recording (returns 204 No Content).
    /// Idempotent: popping an absent bubble-up also returns 204.
    ///
    /// `DELETE /recordings/{recordingId}/bubble_up.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn delete_bubble_up(&self, recording_id: i64) -> Result<(), Error> {
        let operation = self
            .client
            .operation(&routes::DELETE_BUBBLE_UP, &[&recording_id]);
        self.client.send_unit(operation).await
    }
}