/// <summary> Remove a participant from a thread asynchronously.</summary> /// <param name="user"><see cref="CommunicationUserIdentifier" /> to be removed from the chat thread participants.</param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception> public virtual async Task <Response> RemoveParticipantAsync(CommunicationUserIdentifier user, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ChatThreadClient)}.{nameof(RemoveParticipant)}"); scope.Start(); try { return(await _chatThreadRestClient.RemoveChatParticipantAsync(Id, user.Id, cancellationToken).ConfigureAwait(false)); } catch (Exception ex) { scope.Failed(ex); throw; } }
/// <summary> Remove a participant from a thread asynchronously.</summary> /// <param name="identifier"><see cref="CommunicationIdentifier" /> to be removed from the chat thread participants.</param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception> public virtual async Task <Response> RemoveParticipantAsync(CommunicationIdentifier identifier, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ChatThreadClient)}.{nameof(RemoveParticipant)}"); scope.Start(); try { CommunicationIdentifierModel communicationIdentifierModel = CommunicationIdentifierSerializer.Serialize(identifier); return(await _chatThreadRestClient.RemoveChatParticipantAsync(Id, communicationIdentifierModel.RawId, communicationIdentifierModel.CommunicationUser, communicationIdentifierModel.PhoneNumber, communicationIdentifierModel.MicrosoftTeamsUser, cancellationToken).ConfigureAwait(false)); } catch (Exception ex) { scope.Failed(ex); throw; } }