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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
//! CardColumns 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::*;
/// `CardColumns` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct CardColumnsService<'a> {
client: &'a AccountClient,
}
impl<'a> CardColumnsService<'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
}
/// Create a column in a card table
///
/// `POST /card_tables/{cardTableId}/columns.json` — not idempotent, sent exactly once.
pub async fn create(
&self,
card_table_id: i64,
body: &CreateCardColumnRequestContent,
) -> Result<CreateCardColumnResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::CREATE_CARD_COLUMN, &[&card_table_id]);
operation.json(body)?;
self.client.send(operation).await
}
/// Disable on-hold section in a column
///
/// `DELETE /buckets/{bucketId}/card_tables/columns/{columnId}/on_hold.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn disable_on_hold(
&self,
bucket_id: i64,
column_id: i64,
) -> Result<DisableCardColumnOnHoldResponseContent, Error> {
let operation = self.client.operation(
&routes::DISABLE_CARD_COLUMN_ON_HOLD,
&[&bucket_id, &column_id],
);
self.client.send(operation).await
}
/// Enable on-hold section in a column
///
/// `POST /buckets/{bucketId}/card_tables/columns/{columnId}/on_hold.json` — idempotent; retries up to 2 attempt(s) on 429, 503.
pub async fn enable_on_hold(
&self,
bucket_id: i64,
column_id: i64,
) -> Result<EnableCardColumnOnHoldResponseContent, Error> {
let operation = self.client.operation(
&routes::ENABLE_CARD_COLUMN_ON_HOLD,
&[&bucket_id, &column_id],
);
self.client.send(operation).await
}
/// Get a card column by ID
///
/// `GET /card_tables/columns/{columnId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn get(&self, column_id: i64) -> Result<GetCardColumnResponseContent, Error> {
let operation = self
.client
.operation(&routes::GET_CARD_COLUMN, &[&column_id]);
self.client.send(operation).await
}
/// Move a column to a slot within its card table. target_id is the card table's own id (the same as cardTableId), not a column; position is the 1-based slot among the columns, not counting Triage, Not Now or Done.
///
/// `POST /card_tables/{cardTableId}/moves.json` — not idempotent, sent exactly once.
pub async fn move_column(
&self,
card_table_id: i64,
body: &MoveCardColumnRequestContent,
) -> Result<(), Error> {
let mut operation = self
.client
.operation(&routes::MOVE_CARD_COLUMN, &[&card_table_id]);
operation.json(body)?;
self.client.send_unit(operation).await
}
/// Set the color of a column
///
/// `PUT /buckets/{bucketId}/card_tables/columns/{columnId}/color.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn set_color(
&self,
bucket_id: i64,
column_id: i64,
body: &SetCardColumnColorRequestContent,
) -> Result<SetCardColumnColorResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::SET_CARD_COLUMN_COLOR, &[&bucket_id, &column_id]);
operation.json(body)?;
self.client.send(operation).await
}
/// Subscribe to a card column (watch for changes)
///
/// `POST /card_tables/lists/{columnId}/subscription.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn subscribe_to_column(&self, column_id: i64) -> Result<(), Error> {
let operation = self
.client
.operation(&routes::SUBSCRIBE_TO_CARD_COLUMN, &[&column_id]);
self.client.send_unit(operation).await
}
/// Unsubscribe from a card column (stop watching for changes)
///
/// `DELETE /card_tables/lists/{columnId}/subscription.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn unsubscribe_from_column(&self, column_id: i64) -> Result<(), Error> {
let operation = self
.client
.operation(&routes::UNSUBSCRIBE_FROM_CARD_COLUMN, &[&column_id]);
self.client.send_unit(operation).await
}
/// Update an existing column
///
/// `PUT /card_tables/columns/{columnId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn update(
&self,
column_id: i64,
body: &UpdateCardColumnRequestContent,
) -> Result<UpdateCardColumnResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::UPDATE_CARD_COLUMN, &[&column_id]);
operation.json(body)?;
self.client.send(operation).await
}
}