slack_web_api/api/
migration.rs1#![allow(unused_imports)]
4
5use crate::objects::*;
6use crate::{
7 CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
8};
9use serde::{Deserialize, Serialize};
10
11#[doc(alias = "migration.exchange")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct MigrationExchangeRequest {
18 #[serde(serialize_with = "crate::form::as_json")]
20 pub users: Vec<serde_json::Value>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub team_id: Option<String>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub to_old: Option<bool>,
27}
28
29impl MigrationExchangeRequest {
30 pub fn new(users: Vec<serde_json::Value>) -> Self {
31 Self {
32 users,
33 team_id: None,
34 to_old: None,
35 }
36 }
37
38 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
39 self.team_id = Some(team_id.into());
40 self
41 }
42
43 pub fn to_old(mut self, to_old: bool) -> Self {
44 self.to_old = Some(to_old);
45 self
46 }
47}
48
49impl SlackApiMethod for MigrationExchangeRequest {
50 const METHOD: &'static str = "migration.exchange";
51 type Response = MigrationExchangeResponse;
52}
53
54#[doc(alias = "migration.exchange")]
56#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
57pub struct MigrationExchangeResponse {
58 #[serde(
59 default,
60 deserialize_with = "crate::de::opt_string",
61 skip_serializing_if = "Option::is_none"
62 )]
63 pub team_id: Option<String>,
64 #[serde(
65 default,
66 deserialize_with = "crate::de::opt_string",
67 skip_serializing_if = "Option::is_none"
68 )]
69 pub enterprise_id: Option<String>,
70 #[serde(
71 default,
72 deserialize_with = "crate::de::opt_object",
73 skip_serializing_if = "Option::is_none"
74 )]
75 pub user_id_map: Option<std::collections::HashMap<String, String>>,
76 #[serde(
77 default,
78 deserialize_with = "crate::de::vec",
79 skip_serializing_if = "Vec::is_empty"
80 )]
81 pub invalid_user_ids: Vec<String>,
82 #[serde(
83 default,
84 deserialize_with = "crate::de::opt_object",
85 skip_serializing_if = "Option::is_none"
86 )]
87 pub response_metadata: Option<ResponseMetadata>,
88 #[serde(
89 default,
90 deserialize_with = "crate::de::opt_string",
91 skip_serializing_if = "Option::is_none"
92 )]
93 pub warning: Option<String>,
94}
95
96impl SlackClient {
97 #[doc(alias = "migration.exchange")]
110 pub async fn migration_exchange(
111 &self,
112 request: &MigrationExchangeRequest,
113 ) -> Result<MigrationExchangeResponse, SlackError> {
114 self.call(request).await
115 }
116}