Skip to main content

fizzy_sdk/generated/services/
columns.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::*;
7
8/// The `Columns` operations.
9pub struct ColumnsService<'a> {
10    scope: Scope<'a>,
11}
12
13impl<'a> ColumnsService<'a> {
14    pub(crate) fn new(scope: Scope<'a>) -> Self {
15        Self { scope }
16    }
17
18    /// The client and account these operations send through.
19    pub fn scope(&self) -> &Scope<'a> {
20        &self.scope
21    }
22
23    /// `CreateColumn` — `POST /{accountId}/boards/{boardId}/columns.json`.
24    ///
25    /// Sent once and never resent.
26    pub async fn create(
27        &self,
28        board_id: &str,
29        body: &CreateColumnRequestContent,
30    ) -> Result<Column, Error> {
31        let mut operation = self.scope.operation(&routes::CREATE_COLUMN, &[&board_id])?;
32        operation.resource_id(board_id);
33        operation.json(body)?;
34        self.scope.client().send(operation).await
35    }
36
37    /// `DeleteColumn` — `DELETE /{accountId}/boards/{boardId}/columns/{columnId}`.
38    ///
39    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
40    pub async fn delete(&self, board_id: &str, column_id: &str) -> Result<(), Error> {
41        let mut operation = self
42            .scope
43            .operation(&routes::DELETE_COLUMN, &[&board_id, &column_id])?;
44        operation.resource_id(column_id);
45        self.scope.client().send_unit(operation).await
46    }
47
48    /// `GetColumn` — `GET /{accountId}/boards/{boardId}/columns/{columnId}`.
49    ///
50    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
51    pub async fn get(&self, board_id: &str, column_id: &str) -> Result<Column, Error> {
52        let mut operation = self
53            .scope
54            .operation(&routes::GET_COLUMN, &[&board_id, &column_id])?;
55        operation.resource_id(column_id);
56        self.scope.client().send(operation).await
57    }
58
59    /// `ListColumns` — `GET /{accountId}/boards/{boardId}/columns.json`.
60    ///
61    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
62    pub async fn list(&self, board_id: &str) -> Result<Vec<Column>, Error> {
63        let mut operation = self.scope.operation(&routes::LIST_COLUMNS, &[&board_id])?;
64        operation.resource_id(board_id);
65        self.scope.client().send(operation).await
66    }
67
68    /// `MoveColumnLeft` — `POST /{accountId}/columns/{columnId}/left_position.json`.
69    ///
70    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503. Idempotent, so a resend is safe.
71    pub async fn move_left(&self, column_id: &str) -> Result<(), Error> {
72        let mut operation = self
73            .scope
74            .operation(&routes::MOVE_COLUMN_LEFT, &[&column_id])?;
75        operation.resource_id(column_id);
76        self.scope.client().send_unit(operation).await
77    }
78
79    /// `MoveColumnRight` — `POST /{accountId}/columns/{columnId}/right_position.json`.
80    ///
81    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503. Idempotent, so a resend is safe.
82    pub async fn move_right(&self, column_id: &str) -> Result<(), Error> {
83        let mut operation = self
84            .scope
85            .operation(&routes::MOVE_COLUMN_RIGHT, &[&column_id])?;
86        operation.resource_id(column_id);
87        self.scope.client().send_unit(operation).await
88    }
89
90    /// `UpdateColumn` — `PATCH /{accountId}/boards/{boardId}/columns/{columnId}`.
91    ///
92    /// Sent up to 3 times, backing off from 1000 ms, when the answer is 429, 500 or 503.
93    pub async fn update(
94        &self,
95        board_id: &str,
96        column_id: &str,
97        body: &UpdateColumnRequestContent,
98    ) -> Result<Column, Error> {
99        let mut operation = self
100            .scope
101            .operation(&routes::UPDATE_COLUMN, &[&board_id, &column_id])?;
102        operation.resource_id(column_id);
103        operation.json(body)?;
104        self.scope.client().send(operation).await
105    }
106}