use reqwest;
use super::ResponseContent;
use super::{Error, configuration};
#[derive(Clone, Debug, Default)]
pub struct AddGroupMembersParams {
pub group_id: String,
pub add_group_members_request: crate::openapi::models::AddGroupMembersRequest,
}
#[derive(Clone, Debug, Default)]
pub struct CreateGroupParams {
pub create_group_request: crate::openapi::models::CreateGroupRequest,
}
#[derive(Clone, Debug, Default)]
pub struct DeleteGroupParams {
pub group_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct DeleteGroupMembersParams {
pub group_id: String,
pub delete_group_members_request: crate::openapi::models::DeleteGroupMembersRequest,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupParams {
pub group_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupStatsParams {
pub group_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupSyncableForChannelIdParams {
pub group_id: String,
pub channel_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupSyncableForTeamIdParams {
pub group_id: String,
pub team_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupSyncablesChannelsParams {
pub group_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupSyncablesTeamsParams {
pub group_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupUsersParams {
pub group_id: String,
pub page: Option<i32>,
pub per_page: Option<i32>,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupsParams {
pub not_associated_to_team: String,
pub not_associated_to_channel: String,
pub page: Option<i32>,
pub per_page: Option<i32>,
pub q: Option<String>,
pub include_member_count: Option<bool>,
pub since: Option<i32>,
pub filter_allow_reference: Option<bool>,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupsAssociatedToChannelsByTeamParams {
pub team_id: String,
pub page: Option<i32>,
pub per_page: Option<i32>,
pub filter_allow_reference: Option<bool>,
pub paginate: Option<bool>,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupsByChannelParams {
pub channel_id: String,
pub page: Option<i32>,
pub per_page: Option<i32>,
pub filter_allow_reference: Option<bool>,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupsByTeamParams {
pub team_id: String,
pub page: Option<i32>,
pub per_page: Option<i32>,
pub filter_allow_reference: Option<bool>,
}
#[derive(Clone, Debug, Default)]
pub struct GetGroupsByUserIdParams {
pub user_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct LinkGroupSyncableForChannelParams {
pub group_id: String,
pub channel_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct LinkGroupSyncableForTeamParams {
pub group_id: String,
pub team_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct PatchGroupParams {
pub group_id: String,
pub patch_group_request: crate::openapi::models::PatchGroupRequest,
}
#[derive(Clone, Debug, Default)]
pub struct PatchGroupSyncableForChannelParams {
pub group_id: String,
pub channel_id: String,
pub patch_group_syncable_for_team_request:
crate::openapi::models::PatchGroupSyncableForTeamRequest,
}
#[derive(Clone, Debug, Default)]
pub struct PatchGroupSyncableForTeamParams {
pub group_id: String,
pub team_id: String,
pub patch_group_syncable_for_team_request:
crate::openapi::models::PatchGroupSyncableForTeamRequest,
}
#[derive(Clone, Debug, Default)]
pub struct UnlinkGroupSyncableForChannelParams {
pub group_id: String,
pub channel_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct UnlinkGroupSyncableForTeamParams {
pub group_id: String,
pub team_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct UnlinkLdapGroupParams {
pub remote_id: String,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum AddGroupMembersError {
Status403(crate::openapi::models::AppError),
Status501(),
Status404(),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum CreateGroupError {
Status501(),
Status400(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum DeleteGroupError {
Status403(crate::openapi::models::AppError),
Status501(),
Status404(),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum DeleteGroupMembersError {
Status403(crate::openapi::models::AppError),
Status501(),
Status404(),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupStatsError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupSyncableForChannelIdError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupSyncableForTeamIdError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupSyncablesChannelsError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupSyncablesTeamsError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupUsersError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupsError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupsAssociatedToChannelsByTeamError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupsByChannelError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupsByTeamError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status500(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetGroupsByUserIdError {
Status400(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum LinkGroupSyncableForChannelError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum LinkGroupSyncableForTeamError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum PatchGroupError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum PatchGroupSyncableForChannelError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum PatchGroupSyncableForTeamError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum UnlinkGroupSyncableForChannelError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum UnlinkGroupSyncableForTeamError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status501(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum UnlinkLdapGroupError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
pub async fn add_group_members(
configuration: &configuration::Configuration,
params: AddGroupMembersParams,
) -> Result<crate::openapi::models::StatusOk, Error<AddGroupMembersError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let add_group_members_request = params.add_group_members_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/members",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&add_group_members_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddGroupMembersError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn create_group(
configuration: &configuration::Configuration,
params: CreateGroupParams,
) -> Result<(), Error<CreateGroupError>> {
let local_var_configuration = configuration;
let create_group_request = params.create_group_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v4/groups", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&create_group_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<CreateGroupError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn delete_group(
configuration: &configuration::Configuration,
params: DeleteGroupParams,
) -> Result<crate::openapi::models::StatusOk, Error<DeleteGroupError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DeleteGroupError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn delete_group_members(
configuration: &configuration::Configuration,
params: DeleteGroupMembersParams,
) -> Result<crate::openapi::models::StatusOk, Error<DeleteGroupMembersError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let delete_group_members_request = params.delete_group_members_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/members",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&delete_group_members_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DeleteGroupMembersError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group(
configuration: &configuration::Configuration,
params: GetGroupParams,
) -> Result<crate::openapi::models::Group, Error<GetGroupError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group_stats(
configuration: &configuration::Configuration,
params: GetGroupStatsParams,
) -> Result<crate::openapi::models::GetGroupStats200Response, Error<GetGroupStatsError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/stats",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupStatsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group_syncable_for_channel_id(
configuration: &configuration::Configuration,
params: GetGroupSyncableForChannelIdParams,
) -> Result<crate::openapi::models::GroupSyncableChannel, Error<GetGroupSyncableForChannelIdError>>
{
let local_var_configuration = configuration;
let group_id = params.group_id;
let channel_id = params.channel_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/channels/{channel_id}",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
channel_id = super::urlencode(channel_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupSyncableForChannelIdError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group_syncable_for_team_id(
configuration: &configuration::Configuration,
params: GetGroupSyncableForTeamIdParams,
) -> Result<crate::openapi::models::GroupSyncableTeam, Error<GetGroupSyncableForTeamIdError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let team_id = params.team_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/teams/{team_id}",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
team_id = super::urlencode(team_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupSyncableForTeamIdError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group_syncables_channels(
configuration: &configuration::Configuration,
params: GetGroupSyncablesChannelsParams,
) -> Result<Vec<crate::openapi::models::GroupSyncableChannels>, Error<GetGroupSyncablesChannelsError>>
{
let local_var_configuration = configuration;
let group_id = params.group_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/channels",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupSyncablesChannelsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group_syncables_teams(
configuration: &configuration::Configuration,
params: GetGroupSyncablesTeamsParams,
) -> Result<Vec<crate::openapi::models::GroupSyncableTeams>, Error<GetGroupSyncablesTeamsError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/teams",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupSyncablesTeamsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_group_users(
configuration: &configuration::Configuration,
params: GetGroupUsersParams,
) -> Result<crate::openapi::models::GetGroupUsers200Response, Error<GetGroupUsersError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let page = params.page;
let per_page = params.per_page;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/members",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupUsersError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_groups(
configuration: &configuration::Configuration,
params: GetGroupsParams,
) -> Result<Vec<crate::openapi::models::Group>, Error<GetGroupsError>> {
let local_var_configuration = configuration;
let not_associated_to_team = params.not_associated_to_team;
let not_associated_to_channel = params.not_associated_to_channel;
let page = params.page;
let per_page = params.per_page;
let q = params.q;
let include_member_count = params.include_member_count;
let since = params.since;
let filter_allow_reference = params.filter_allow_reference;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v4/groups", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = q {
local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = include_member_count {
local_var_req_builder =
local_var_req_builder.query(&[("include_member_count", &local_var_str.to_string())]);
}
local_var_req_builder = local_var_req_builder.query(&[(
"not_associated_to_team",
¬_associated_to_team.to_string(),
)]);
local_var_req_builder = local_var_req_builder.query(&[(
"not_associated_to_channel",
¬_associated_to_channel.to_string(),
)]);
if let Some(ref local_var_str) = since {
local_var_req_builder =
local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = filter_allow_reference {
local_var_req_builder =
local_var_req_builder.query(&[("filter_allow_reference", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_groups_associated_to_channels_by_team(
configuration: &configuration::Configuration,
params: GetGroupsAssociatedToChannelsByTeamParams,
) -> Result<
Vec<::std::collections::HashMap<String, Vec<crate::openapi::models::GroupWithSchemeAdmin>>>,
Error<GetGroupsAssociatedToChannelsByTeamError>,
> {
let local_var_configuration = configuration;
let team_id = params.team_id;
let page = params.page;
let per_page = params.per_page;
let filter_allow_reference = params.filter_allow_reference;
let paginate = params.paginate;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/teams/{team_id}/groups_by_channels",
local_var_configuration.base_path,
team_id = super::urlencode(team_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = filter_allow_reference {
local_var_req_builder =
local_var_req_builder.query(&[("filter_allow_reference", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = paginate {
local_var_req_builder =
local_var_req_builder.query(&[("paginate", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupsAssociatedToChannelsByTeamError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_groups_by_channel(
configuration: &configuration::Configuration,
params: GetGroupsByChannelParams,
) -> Result<Vec<crate::openapi::models::Group>, Error<GetGroupsByChannelError>> {
let local_var_configuration = configuration;
let channel_id = params.channel_id;
let page = params.page;
let per_page = params.per_page;
let filter_allow_reference = params.filter_allow_reference;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/channels/{channel_id}/groups",
local_var_configuration.base_path,
channel_id = super::urlencode(channel_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = filter_allow_reference {
local_var_req_builder =
local_var_req_builder.query(&[("filter_allow_reference", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupsByChannelError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_groups_by_team(
configuration: &configuration::Configuration,
params: GetGroupsByTeamParams,
) -> Result<Vec<crate::openapi::models::Group>, Error<GetGroupsByTeamError>> {
let local_var_configuration = configuration;
let team_id = params.team_id;
let page = params.page;
let per_page = params.per_page;
let filter_allow_reference = params.filter_allow_reference;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/teams/{team_id}/groups",
local_var_configuration.base_path,
team_id = super::urlencode(team_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = filter_allow_reference {
local_var_req_builder =
local_var_req_builder.query(&[("filter_allow_reference", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupsByTeamError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_groups_by_user_id(
configuration: &configuration::Configuration,
params: GetGroupsByUserIdParams,
) -> Result<Vec<crate::openapi::models::Group>, Error<GetGroupsByUserIdError>> {
let local_var_configuration = configuration;
let user_id = params.user_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/users/{user_id}/groups",
local_var_configuration.base_path,
user_id = super::urlencode(user_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetGroupsByUserIdError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn link_group_syncable_for_channel(
configuration: &configuration::Configuration,
params: LinkGroupSyncableForChannelParams,
) -> Result<crate::openapi::models::GroupSyncableChannel, Error<LinkGroupSyncableForChannelError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let channel_id = params.channel_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/channels/{channel_id}/link",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
channel_id = super::urlencode(channel_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<LinkGroupSyncableForChannelError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn link_group_syncable_for_team(
configuration: &configuration::Configuration,
params: LinkGroupSyncableForTeamParams,
) -> Result<crate::openapi::models::GroupSyncableTeam, Error<LinkGroupSyncableForTeamError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let team_id = params.team_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/teams/{team_id}/link",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
team_id = super::urlencode(team_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<LinkGroupSyncableForTeamError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn patch_group(
configuration: &configuration::Configuration,
params: PatchGroupParams,
) -> Result<crate::openapi::models::Group, Error<PatchGroupError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let patch_group_request = params.patch_group_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/patch",
local_var_configuration.base_path,
group_id = super::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&patch_group_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<PatchGroupError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn patch_group_syncable_for_channel(
configuration: &configuration::Configuration,
params: PatchGroupSyncableForChannelParams,
) -> Result<crate::openapi::models::GroupSyncableChannel, Error<PatchGroupSyncableForChannelError>>
{
let local_var_configuration = configuration;
let group_id = params.group_id;
let channel_id = params.channel_id;
let patch_group_syncable_for_team_request = params.patch_group_syncable_for_team_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/channels/{channel_id}/patch",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
channel_id = super::urlencode(channel_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&patch_group_syncable_for_team_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<PatchGroupSyncableForChannelError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn patch_group_syncable_for_team(
configuration: &configuration::Configuration,
params: PatchGroupSyncableForTeamParams,
) -> Result<crate::openapi::models::GroupSyncableTeam, Error<PatchGroupSyncableForTeamError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let team_id = params.team_id;
let patch_group_syncable_for_team_request = params.patch_group_syncable_for_team_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/teams/{team_id}/patch",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
team_id = super::urlencode(team_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&patch_group_syncable_for_team_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<PatchGroupSyncableForTeamError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn unlink_group_syncable_for_channel(
configuration: &configuration::Configuration,
params: UnlinkGroupSyncableForChannelParams,
) -> Result<crate::openapi::models::StatusOk, Error<UnlinkGroupSyncableForChannelError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let channel_id = params.channel_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/channels/{channel_id}/link",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
channel_id = super::urlencode(channel_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UnlinkGroupSyncableForChannelError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn unlink_group_syncable_for_team(
configuration: &configuration::Configuration,
params: UnlinkGroupSyncableForTeamParams,
) -> Result<crate::openapi::models::StatusOk, Error<UnlinkGroupSyncableForTeamError>> {
let local_var_configuration = configuration;
let group_id = params.group_id;
let team_id = params.team_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/groups/{group_id}/teams/{team_id}/link",
local_var_configuration.base_path,
group_id = super::urlencode(group_id),
team_id = super::urlencode(team_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UnlinkGroupSyncableForTeamError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn unlink_ldap_group(
configuration: &configuration::Configuration,
params: UnlinkLdapGroupParams,
) -> Result<crate::openapi::models::StatusOk, Error<UnlinkLdapGroupError>> {
let local_var_configuration = configuration;
let remote_id = params.remote_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/ldap/groups/{remote_id}/link",
local_var_configuration.base_path,
remote_id = super::urlencode(remote_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UnlinkLdapGroupError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}