Skip to main content

fizzy_sdk/generated/services/
boards.rs

1// Generated by fizzy-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
2
3use crate::client::Scope;
4use crate::error::Error;
5use crate::generated::routes;
6use crate::generated::types::*;
7use crate::pagination::Page;
8
9/// Optional query parameters for `ListBoardAccesses`.
10#[derive(Debug, Clone, Default, PartialEq)]
11pub struct ListBoardAccessesParams {
12    /// `page`.
13    pub page: Option<i32>,
14}
15
16/// The `Boards` operations.
17pub struct BoardsService<'a> {
18    scope: Scope<'a>,
19}
20
21impl<'a> BoardsService<'a> {
22    pub(crate) fn new(scope: Scope<'a>) -> Self {
23        Self { scope }
24    }
25
26    /// The client and account these operations send through.
27    pub fn scope(&self) -> &Scope<'a> {
28        &self.scope
29    }
30
31    /// `CreateBoard` — `POST /{accountId}/boards.json`.
32    ///
33    /// Sent once and never resent.
34    pub async fn create(&self, body: &CreateBoardRequestContent) -> Result<Board, Error> {
35        let mut operation = self.scope.operation(&routes::CREATE_BOARD, &[])?;
36        operation.json(body)?;
37        self.scope.client().send(operation).await
38    }
39
40    /// `DeleteBoard` — `DELETE /{accountId}/boards/{boardId}`.
41    ///
42    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
43    pub async fn delete(&self, board_id: &str) -> Result<(), Error> {
44        let mut operation = self.scope.operation(&routes::DELETE_BOARD, &[&board_id])?;
45        operation.resource_id(board_id);
46        self.scope.client().send_unit(operation).await
47    }
48
49    /// `GetBoard` — `GET /{accountId}/boards/{boardId}`.
50    ///
51    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
52    pub async fn get(&self, board_id: &str) -> Result<Board, Error> {
53        let mut operation = self.scope.operation(&routes::GET_BOARD, &[&board_id])?;
54        operation.resource_id(board_id);
55        self.scope.client().send(operation).await
56    }
57
58    /// `ListBoards` — `GET /{accountId}/boards.json`.
59    ///
60    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
61    ///
62    /// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
63    pub async fn list(&self) -> Result<Page<Vec<Board>>, Error> {
64        let operation = self.scope.operation(&routes::LIST_BOARDS, &[])?;
65        self.scope.client().send_page(operation).await
66    }
67
68    /// `ListBoardAccesses` — `GET /{accountId}/boards/{boardId}/accesses.json`.
69    ///
70    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
71    pub async fn list_board_accesses(
72        &self,
73        board_id: &str,
74        params: &ListBoardAccessesParams,
75    ) -> Result<BoardAccesses, Error> {
76        let mut operation = self
77            .scope
78            .operation(&routes::LIST_BOARD_ACCESSES, &[&board_id])?;
79        operation.resource_id(board_id);
80        operation.query_optional("page", params.page.as_ref());
81        self.scope.client().send(operation).await
82    }
83
84    /// `ListClosedCards` — `GET /{accountId}/boards/{boardId}/columns/closed.json`.
85    ///
86    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
87    ///
88    /// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
89    pub async fn list_closed(&self, board_id: &str) -> Result<Page<Vec<Card>>, Error> {
90        let mut operation = self
91            .scope
92            .operation(&routes::LIST_CLOSED_CARDS, &[&board_id])?;
93        operation.resource_id(board_id);
94        self.scope.client().send_page(operation).await
95    }
96
97    /// `ListPostponedCards` — `GET /{accountId}/boards/{boardId}/columns/not_now.json`.
98    ///
99    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
100    ///
101    /// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
102    pub async fn list_postponed(&self, board_id: &str) -> Result<Page<Vec<Card>>, Error> {
103        let mut operation = self
104            .scope
105            .operation(&routes::LIST_POSTPONED_CARDS, &[&board_id])?;
106        operation.resource_id(board_id);
107        self.scope.client().send_page(operation).await
108    }
109
110    /// `ListStreamCards` — `GET /{accountId}/boards/{boardId}/columns/stream.json`.
111    ///
112    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
113    ///
114    /// Paginated: the answer is a page with `page` as its cursor, and the next one is read with `next_page`.
115    pub async fn list_stream(&self, board_id: &str) -> Result<Page<Vec<Card>>, Error> {
116        let mut operation = self
117            .scope
118            .operation(&routes::LIST_STREAM_CARDS, &[&board_id])?;
119        operation.resource_id(board_id);
120        self.scope.client().send_page(operation).await
121    }
122
123    /// `PublishBoard` — `POST /{accountId}/boards/{boardId}/publication.json`.
124    ///
125    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503. Idempotent, so a resend is safe.
126    pub async fn publish(&self, board_id: &str) -> Result<(), Error> {
127        let mut operation = self.scope.operation(&routes::PUBLISH_BOARD, &[&board_id])?;
128        operation.resource_id(board_id);
129        self.scope.client().send_unit(operation).await
130    }
131
132    /// `UnpublishBoard` — `DELETE /{accountId}/boards/{boardId}/publication.json`.
133    ///
134    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
135    pub async fn unpublish(&self, board_id: &str) -> Result<(), Error> {
136        let mut operation = self
137            .scope
138            .operation(&routes::UNPUBLISH_BOARD, &[&board_id])?;
139        operation.resource_id(board_id);
140        self.scope.client().send_unit(operation).await
141    }
142
143    /// `UpdateBoard` — `PATCH /{accountId}/boards/{boardId}`.
144    ///
145    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
146    pub async fn update(
147        &self,
148        board_id: &str,
149        body: &UpdateBoardRequestContent,
150    ) -> Result<Board, Error> {
151        let mut operation = self.scope.operation(&routes::UPDATE_BOARD, &[&board_id])?;
152        operation.resource_id(board_id);
153        operation.json(body)?;
154        self.scope.client().send(operation).await
155    }
156
157    /// `UpdateBoardEntropy` — `PUT /{accountId}/boards/{boardId}/entropy.json`.
158    ///
159    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
160    pub async fn update_entropy(
161        &self,
162        board_id: &str,
163        body: &UpdateBoardEntropyRequestContent,
164    ) -> Result<Board, Error> {
165        let mut operation = self
166            .scope
167            .operation(&routes::UPDATE_BOARD_ENTROPY, &[&board_id])?;
168        operation.resource_id(board_id);
169        operation.json(body)?;
170        self.scope.client().send(operation).await
171    }
172
173    /// `UpdateBoardInvolvement` — `PATCH /{accountId}/boards/{boardId}/involvement.json`.
174    ///
175    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
176    pub async fn update_involvement(
177        &self,
178        board_id: &str,
179        body: &UpdateBoardInvolvementRequestContent,
180    ) -> Result<(), Error> {
181        let mut operation = self
182            .scope
183            .operation(&routes::UPDATE_BOARD_INVOLVEMENT, &[&board_id])?;
184        operation.resource_id(board_id);
185        operation.json(body)?;
186        self.scope.client().send_unit(operation).await
187    }
188}