fizzy_sdk/generated/services/
columns.rs1use crate::client::Scope;
4use crate::error::Error;
5use crate::generated::routes;
6use crate::generated::types::*;
7
8pub 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 pub fn scope(&self) -> &Scope<'a> {
20 &self.scope
21 }
22
23 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 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 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 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 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 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 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}