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
// Generated by fizzy-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
use crate::client::Scope;
use crate::error::Error;
use crate::generated::routes;
use crate::generated::types::*;
/// The `Columns` operations.
pub struct ColumnsService<'a> {
scope: Scope<'a>,
}
impl<'a> ColumnsService<'a> {
pub(crate) fn new(scope: Scope<'a>) -> Self {
Self { scope }
}
/// The client and account these operations send through.
pub fn scope(&self) -> &Scope<'a> {
&self.scope
}
/// `CreateColumn` — `POST /{accountId}/boards/{boardId}/columns.json`.
///
/// Sent once and never resent.
pub async fn create(
&self,
board_id: &str,
body: &CreateColumnRequestContent,
) -> Result<Column, Error> {
let mut operation = self.scope.operation(&routes::CREATE_COLUMN, &[&board_id])?;
operation.resource_id(board_id);
operation.json(body)?;
self.scope.client().send(operation).await
}
/// `DeleteColumn` — `DELETE /{accountId}/boards/{boardId}/columns/{columnId}`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn delete(&self, board_id: &str, column_id: &str) -> Result<(), Error> {
let mut operation = self
.scope
.operation(&routes::DELETE_COLUMN, &[&board_id, &column_id])?;
operation.resource_id(column_id);
self.scope.client().send_unit(operation).await
}
/// `GetColumn` — `GET /{accountId}/boards/{boardId}/columns/{columnId}`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn get(&self, board_id: &str, column_id: &str) -> Result<Column, Error> {
let mut operation = self
.scope
.operation(&routes::GET_COLUMN, &[&board_id, &column_id])?;
operation.resource_id(column_id);
self.scope.client().send(operation).await
}
/// `ListColumns` — `GET /{accountId}/boards/{boardId}/columns.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn list(&self, board_id: &str) -> Result<Vec<Column>, Error> {
let mut operation = self.scope.operation(&routes::LIST_COLUMNS, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send(operation).await
}
/// `MoveColumnLeft` — `POST /{accountId}/columns/{columnId}/left_position.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503. Idempotent, so a resend is safe.
pub async fn move_left(&self, column_id: &str) -> Result<(), Error> {
let mut operation = self
.scope
.operation(&routes::MOVE_COLUMN_LEFT, &[&column_id])?;
operation.resource_id(column_id);
self.scope.client().send_unit(operation).await
}
/// `MoveColumnRight` — `POST /{accountId}/columns/{columnId}/right_position.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503. Idempotent, so a resend is safe.
pub async fn move_right(&self, column_id: &str) -> Result<(), Error> {
let mut operation = self
.scope
.operation(&routes::MOVE_COLUMN_RIGHT, &[&column_id])?;
operation.resource_id(column_id);
self.scope.client().send_unit(operation).await
}
/// `UpdateColumn` — `PATCH /{accountId}/boards/{boardId}/columns/{columnId}`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn update(
&self,
board_id: &str,
column_id: &str,
body: &UpdateColumnRequestContent,
) -> Result<Column, Error> {
let mut operation = self
.scope
.operation(&routes::UPDATE_COLUMN, &[&board_id, &column_id])?;
operation.resource_id(column_id);
operation.json(body)?;
self.scope.client().send(operation).await
}
}