#![allow(unused_imports)]
use crate::objects::*;
use crate::{
CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
};
use serde::{Deserialize, Serialize};
#[doc(alias = "migration.exchange")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct MigrationExchangeRequest {
#[serde(serialize_with = "crate::form::as_json")]
pub users: Vec<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub to_old: Option<bool>,
}
impl MigrationExchangeRequest {
pub fn new(users: Vec<serde_json::Value>) -> Self {
Self {
users,
team_id: None,
to_old: None,
}
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
pub fn to_old(mut self, to_old: bool) -> Self {
self.to_old = Some(to_old);
self
}
}
impl SlackApiMethod for MigrationExchangeRequest {
const METHOD: &'static str = "migration.exchange";
type Response = MigrationExchangeResponse;
}
#[doc(alias = "migration.exchange")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct MigrationExchangeResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub team_id: Option<String>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub enterprise_id: Option<String>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub user_id_map: Option<std::collections::HashMap<String, String>>,
#[serde(
default,
deserialize_with = "crate::de::vec",
skip_serializing_if = "Vec::is_empty"
)]
pub invalid_user_ids: Vec<String>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub response_metadata: Option<ResponseMetadata>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<String>,
}
impl SlackClient {
#[doc(alias = "migration.exchange")]
pub async fn migration_exchange(
&self,
request: &MigrationExchangeRequest,
) -> Result<MigrationExchangeResponse, SlackError> {
self.call(request).await
}
}