1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
//! Calendars 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::*;
/// `Calendars` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct CalendarsService<'a> {
client: &'a AccountClient,
}
impl<'a> CalendarsService<'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 a calendar by its bucket id. A Calendar is a top-level BC5 bucketable
/// (distinct from a project) exposing display metadata and a link to its
/// underlying schedule resource. Shipped scope is show + update only.
///
/// `GET /calendars/{calendarId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn get_calendar(
&self,
calendar_id: i64,
) -> Result<GetCalendarResponseContent, Error> {
let operation = self
.client
.operation(&routes::GET_CALENDAR, &[&calendar_id]);
self.client.send(operation).await
}
/// Update a calendar's display color. An unknown color returns 422 with a JSON
/// errors payload keyed by field ({"errors": {"color": \["is not a valid
/// color"\]}}) — the controller rejects invalid enum values up front.
///
/// `PUT /calendars/{calendarId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn update_calendar(
&self,
calendar_id: i64,
body: &UpdateCalendarRequestContent,
) -> Result<UpdateCalendarResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::UPDATE_CALENDAR, &[&calendar_id]);
operation.json(body)?;
self.client.send(operation).await
}
}