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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// 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::*;
use crate::pagination::Page;
/// Optional query parameters for `ListBoardAccesses`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ListBoardAccessesParams {
/// `page`.
pub page: Option<i32>,
}
/// The `Boards` operations.
pub struct BoardsService<'a> {
scope: Scope<'a>,
}
impl<'a> BoardsService<'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
}
/// `CreateBoard` — `POST /{accountId}/boards.json`.
///
/// Sent once and never resent.
pub async fn create(&self, body: &CreateBoardRequestContent) -> Result<Board, Error> {
let mut operation = self.scope.operation(&routes::CREATE_BOARD, &[])?;
operation.json(body)?;
self.scope.client().send(operation).await
}
/// `DeleteBoard` — `DELETE /{accountId}/boards/{boardId}`.
///
/// 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) -> Result<(), Error> {
let mut operation = self.scope.operation(&routes::DELETE_BOARD, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send_unit(operation).await
}
/// `GetBoard` — `GET /{accountId}/boards/{boardId}`.
///
/// 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) -> Result<Board, Error> {
let mut operation = self.scope.operation(&routes::GET_BOARD, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send(operation).await
}
/// `ListBoards` — `GET /{accountId}/boards.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
///
/// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
pub async fn list(&self) -> Result<Page<Vec<Board>>, Error> {
let operation = self.scope.operation(&routes::LIST_BOARDS, &[])?;
self.scope.client().send_page(operation).await
}
/// `ListBoardAccesses` — `GET /{accountId}/boards/{boardId}/accesses.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn list_board_accesses(
&self,
board_id: &str,
params: &ListBoardAccessesParams,
) -> Result<BoardAccesses, Error> {
let mut operation = self
.scope
.operation(&routes::LIST_BOARD_ACCESSES, &[&board_id])?;
operation.resource_id(board_id);
operation.query_optional("page", params.page.as_ref());
self.scope.client().send(operation).await
}
/// `ListClosedCards` — `GET /{accountId}/boards/{boardId}/columns/closed.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
///
/// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
pub async fn list_closed(&self, board_id: &str) -> Result<Page<Vec<Card>>, Error> {
let mut operation = self
.scope
.operation(&routes::LIST_CLOSED_CARDS, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send_page(operation).await
}
/// `ListPostponedCards` — `GET /{accountId}/boards/{boardId}/columns/not_now.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
///
/// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
pub async fn list_postponed(&self, board_id: &str) -> Result<Page<Vec<Card>>, Error> {
let mut operation = self
.scope
.operation(&routes::LIST_POSTPONED_CARDS, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send_page(operation).await
}
/// `ListStreamCards` — `GET /{accountId}/boards/{boardId}/columns/stream.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
///
/// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
pub async fn list_stream(&self, board_id: &str) -> Result<Page<Vec<Card>>, Error> {
let mut operation = self
.scope
.operation(&routes::LIST_STREAM_CARDS, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send_page(operation).await
}
/// `PublishBoard` — `POST /{accountId}/boards/{boardId}/publication.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 publish(&self, board_id: &str) -> Result<(), Error> {
let mut operation = self.scope.operation(&routes::PUBLISH_BOARD, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send_unit(operation).await
}
/// `UnpublishBoard` — `DELETE /{accountId}/boards/{boardId}/publication.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn unpublish(&self, board_id: &str) -> Result<(), Error> {
let mut operation = self
.scope
.operation(&routes::UNPUBLISH_BOARD, &[&board_id])?;
operation.resource_id(board_id);
self.scope.client().send_unit(operation).await
}
/// `UpdateBoard` — `PATCH /{accountId}/boards/{boardId}`.
///
/// 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,
body: &UpdateBoardRequestContent,
) -> Result<Board, Error> {
let mut operation = self.scope.operation(&routes::UPDATE_BOARD, &[&board_id])?;
operation.resource_id(board_id);
operation.json(body)?;
self.scope.client().send(operation).await
}
/// `UpdateBoardEntropy` — `PUT /{accountId}/boards/{boardId}/entropy.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn update_entropy(
&self,
board_id: &str,
body: &UpdateBoardEntropyRequestContent,
) -> Result<Board, Error> {
let mut operation = self
.scope
.operation(&routes::UPDATE_BOARD_ENTROPY, &[&board_id])?;
operation.resource_id(board_id);
operation.json(body)?;
self.scope.client().send(operation).await
}
/// `UpdateBoardInvolvement` — `PATCH /{accountId}/boards/{boardId}/involvement.json`.
///
/// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
pub async fn update_involvement(
&self,
board_id: &str,
body: &UpdateBoardInvolvementRequestContent,
) -> Result<(), Error> {
let mut operation = self
.scope
.operation(&routes::UPDATE_BOARD_INVOLVEMENT, &[&board_id])?;
operation.resource_id(board_id);
operation.json(body)?;
self.scope.client().send_unit(operation).await
}
}