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
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
//! Tools operations.
#![allow(
clippy::too_many_arguments,
clippy::wildcard_imports,
clippy::doc_markdown
)]
use crate::client::AccountClient;
use crate::error::Error;
use crate::generated::routes;
#[allow(unused_imports)]
use crate::generated::types::*;
/// `Tools` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct ToolsService<'a> {
client: &'a AccountClient,
}
impl<'a> ToolsService<'a> {
pub(crate) fn new(client: &'a AccountClient) -> Self {
Self { client }
}
/// The client this service sends through.
pub fn client(&self) -> &'a AccountClient {
self.client
}
/// Create a tool in a project dock
///
/// `POST /buckets/{bucketId}/dock/tools.json` — not idempotent, sent exactly once.
pub async fn create(
&self,
bucket_id: i64,
body: &CreateToolRequestContent,
) -> Result<CreateToolResponseContent, Error> {
let mut operation = self.client.operation(&routes::CREATE_TOOL, &[&bucket_id]);
operation.json(body)?;
self.client.send(operation).await
}
/// Remove a tool from the dock: deletes an external link or an empty extra tool, and disables any other tool (returns 204 No Content either way).
/// Deleted: an external link, or a tool that is empty while the project has another
/// tool of the same type, enabled or disabled. Empty means nothing inside it at all,
/// not even in the trash; for a Card Table only cards count, not columns. A deleted
/// tool does not go to the trash: Basecamp permanently destroys it, with everything
/// inside it, about five days later. Until then, a deleted external link can be
/// restored in the Basecamp web app.
/// Disabled: every other tool, such as the only tool of its type or a tool with
/// anything inside it, archived, draft and trashed items included, exactly as
/// DisableTool does. It keeps its content, and EnableTool restores it. Items already
/// in the trash stay there and can still be restored for the rest of their 25 days.
/// To tell which happened, get the tool afterwards: a deleted tool has status "deleted",
/// while a disabled one keeps its status and has no position.
///
/// `DELETE /dock/tools/{toolId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn delete(&self, tool_id: i64) -> Result<(), Error> {
let operation = self.client.operation(&routes::DELETE_TOOL, &[&tool_id]);
self.client.send_unit(operation).await
}
/// Disable a tool (hide it from the project dock)
///
/// `DELETE /recordings/{toolId}/position.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn disable(&self, tool_id: i64) -> Result<(), Error> {
let operation = self.client.operation(&routes::DISABLE_TOOL, &[&tool_id]);
self.client.send_unit(operation).await
}
/// Enable a tool (show it on the project dock)
///
/// `POST /recordings/{toolId}/position.json` — not idempotent, sent exactly once.
pub async fn enable(&self, tool_id: i64) -> Result<(), Error> {
let operation = self.client.operation(&routes::ENABLE_TOOL, &[&tool_id]);
self.client.send_unit(operation).await
}
/// Get a dock tool by id
///
/// `GET /dock/tools/{toolId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn get(&self, tool_id: i64) -> Result<GetToolResponseContent, Error> {
let operation = self.client.operation(&routes::GET_TOOL, &[&tool_id]);
self.client.send(operation).await
}
/// Reposition a tool on the project dock
///
/// `PUT /recordings/{toolId}/position.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn reposition(
&self,
tool_id: i64,
body: &RepositionToolRequestContent,
) -> Result<(), Error> {
let mut operation = self.client.operation(&routes::REPOSITION_TOOL, &[&tool_id]);
operation.json(body)?;
self.client.send_unit(operation).await
}
/// Update (rename) an existing tool
///
/// `PUT /dock/tools/{toolId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn update(
&self,
tool_id: i64,
body: &UpdateToolRequestContent,
) -> Result<UpdateToolResponseContent, Error> {
let mut operation = self.client.operation(&routes::UPDATE_TOOL, &[&tool_id]);
operation.json(body)?;
self.client.send(operation).await
}
}