Esempio n. 1
0
        /// <summary>
        /// Leaves this conversation.
        /// </summary>
        /// <returns></returns>
        public async Task Quit()
        {
            LCIMPartiallySuccessResult result = await RemoveMembers(new string[] { Client.Id });

            if (!result.IsSuccess)
            {
                LCIMOperationFailure error = result.FailureList[0];
                throw new LCException(error.Code, error.Reason);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Removes members from this conversation.
        /// </summary>
        /// <param name="removeIds">Member list.</param>
        /// <returns></returns>
        public async Task <LCIMPartiallySuccessResult> RemoveMembers(IEnumerable <string> removeIds)
        {
            if (removeIds == null || removeIds.Count() == 0)
            {
                throw new ArgumentNullException(nameof(removeIds));
            }
            LCIMPartiallySuccessResult result = await Client.ConversationController.RemoveMembers(Id, removeIds);

            ids.RemoveWhere(id => result.SuccessfulClientIdList.Contains(id));
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds members to this conversation.
        /// </summary>
        /// <param name="clientIds">Member list.</param>
        /// <returns></returns>
        public virtual async Task <LCIMPartiallySuccessResult> AddMembers(IEnumerable <string> clientIds)
        {
            if (clientIds == null || clientIds.Count() == 0)
            {
                throw new ArgumentNullException(nameof(clientIds));
            }
            LCIMPartiallySuccessResult result = await Client.ConversationController.AddMembers(Id, clientIds);

            ids.UnionWith(result.SuccessfulClientIdList);
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Joins this conversation.
        /// </summary>
        /// <returns></returns>
        public async Task Join()
        {
            LCIMPartiallySuccessResult result = await Client.ConversationController.AddMembers(Id,
                                                                                               new string[] { Client.Id });

            if (result.IsSuccess)
            {
                ids.UnionWith(result.SuccessfulClientIdList);
            }
            else
            {
                LCIMOperationFailure error = result.FailureList[0];
                throw new LCException(error.Code, error.Reason);
            }
        }