public async Task AddUserToGroupAsync(UserManipulationInChannelOrGroupDto model) { var user = await GetUserAsync(model.Login); var group = await GetGroupAsync(model.Title); //generate request of adding var request = new TLRequestInviteToChannel { Channel = new TLInputChannel { ChannelId = group.Id, AccessHash = group.AccessHash.Value }, Users = new TLVector <TLAbsInputUser> { new TLInputUser { UserId = user.Id, AccessHash = user.AccessHash.Value } } }; await client.SendRequestAsync <object>(request); }
public async Task DeleteUserFromGroupAsync(UserManipulationInChannelOrGroupDto model) { var userId = await GetUserIdAsync(model.Login); var groupId = await GetGroupIdAsync(model.Title); var uri = new Uri(_slackApiLink + "channels.kick"); using (HttpClient httpClient = new HttpClient()) { var sendModel = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("token", _slackConfigurations.UserToken), new KeyValuePair <string, string>("channel", groupId), new KeyValuePair <string, string>("user", userId) }; using (FormUrlEncodedContent content = new FormUrlEncodedContent(sendModel)) { await httpClient.PostAsync(uri, content); } } }
public async Task DeleteUserFromGroupAsync(UserManipulationInChannelOrGroupDto model) { var user = await GetUserAsync(model.Login); var group = await GetGroupAsync(model.Title); //generate request of deleting var request = new TLRequestKickFromChannel { Channel = new TLInputChannel { ChannelId = group.Id, AccessHash = group.AccessHash.Value }, UserId = new TLInputUser { UserId = user.Id, AccessHash = user.AccessHash.Value }, Kicked = true }; await client.SendRequestAsync <object>(request); }
public async Task DeleteUserFromChannelAsync(UserManipulationInChannelOrGroupDto model) => throw new NotImplementedException("This method is not supported in Slack");
public async Task AddUserToGroupAsync(UserManipulationInChannelOrGroupDto model) => throw new NotImplementedException("This method is not supported in email");