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
use anyhow::Result;
use crate::Client;
pub struct Migration {
pub client: Client,
}
impl Migration {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
Migration { client }
}
pub async fn exchange(
&self,
users: &str,
team_id: &str,
to_old: bool,
) -> Result<crate::types::MigrationExchangeSuccessSchema> {
let mut query_args: Vec<(String, String)> = Default::default();
if !team_id.is_empty() {
query_args.push(("team_id".to_string(), team_id.to_string()));
}
if to_old {
query_args.push(("to_old".to_string(), to_old.to_string()));
}
if !users.is_empty() {
query_args.push(("users".to_string(), users.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!("/migration.exchange?{}", query_);
self.client.get(&url, None).await
}
}