public async Task <int> RemoveMembers(string topic, [FromBody] ThreadCreationModel model) { Utils.IsNotNull(topic ?? model.Topic, nameof(model.Topic)); Utils.IsNotNull(model.Members, nameof(model.Members)); var chatService = Service.GetCommunicationThreadClient(topic ?? model.Topic); return(await chatService.RemoveMembersAsync(model.Members)); }
public async Task <bool> AddMembers(string topic, [FromBody] ThreadCreationModel model) { Utils.IsNotNull(topic ?? model.Topic, nameof(model.Topic)); Utils.IsNotNullOrEmpty(model.Members, nameof(model.Members)); var chatService = Service.GetCommunicationThreadClient(topic ?? model.Topic); var result = await chatService.AddMembersAsync(model.Members); if (Utils.IsFailure(result)) { throw new Exception("Failed to add members to thread"); } return(true); }
public async Task <Thread> CreateChatThreadAsync(ThreadCreationModel thread) => await CreateChatThreadAsync(thread.Topic, thread.Members.ConvertAll(new Converter <string, User>(StringToUser)));
public async Task <Thread> Create([FromBody] ThreadCreationModel thread) { Utils.IsNotNull(thread.Topic, nameof(thread.Topic)); Utils.IsNotNullOrEmpty(thread.Members, nameof(thread.Members)); return(await Service.CreateChatThreadAsync(thread)); }