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
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
//! Wormholes 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::*;
/// `Wormholes` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct WormholesService<'a> {
client: &'a AccountClient,
}
impl<'a> WormholesService<'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
}
/// Add a wormhole to a card table: a standing shortcut that sends cards to a column on another card table, usually in another project.
///
/// A wormhole's id is a valid `column_id` for MoveCard, teleporting the card to
/// its destination column. It is not needed for a one-off move: MoveCard goes to
/// any column in the card's project directly, and MoveRecording moves a card to
/// another project's card table. Create one only when the card table should keep
/// that shortcut. A card table holds at most four wormholes.
/// `destinationRecordingId` is the id of a column on another accessible card table.
///
/// `POST /buckets/{bucketId}/card_tables/{cardTableId}/wormholes.json` — not idempotent, sent exactly once.
pub async fn create(
&self,
bucket_id: i64,
card_table_id: i64,
body: &CreateWormholeRequestContent,
) -> Result<CreateWormholeResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::CREATE_WORMHOLE, &[&bucket_id, &card_table_id]);
operation.json(body)?;
self.client.send(operation).await
}
/// Permanently delete a card table's wormhole, the shortcut that sends cards to another card table.
///
/// It does not go to the trash and cannot be restored.
///
/// `DELETE /buckets/{bucketId}/card_tables/wormholes/{wormholeId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn delete(&self, bucket_id: i64, wormhole_id: i64) -> Result<(), Error> {
let operation = self
.client
.operation(&routes::DELETE_WORMHOLE, &[&bucket_id, &wormhole_id]);
self.client.send_unit(operation).await
}
/// Point a card table's wormhole, its shortcut for sending cards to another card table, at a different destination column
///
/// `PUT /buckets/{bucketId}/card_tables/wormholes/{wormholeId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn update(
&self,
bucket_id: i64,
wormhole_id: i64,
body: &UpdateWormholeRequestContent,
) -> Result<UpdateWormholeResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::UPDATE_WORMHOLE, &[&bucket_id, &wormhole_id]);
operation.json(body)?;
self.client.send(operation).await
}
}