/// <summary>
        /// Deserialize <see cref="ParticipantsUpdatedEvent"/> event.
        /// </summary>
        /// <param name="content">The json content.</param>
        /// <returns>The new <see cref="ParticipantsUpdatedEvent"/> object.</returns>
        public static ParticipantsUpdatedEvent Deserialize(string content)
        {
            using var document = JsonDocument.Parse(content);
            JsonElement element = document.RootElement;

            var participantsUpdatedEventInternal = ParticipantsUpdatedEventInternal.DeserializeParticipantsUpdatedEventInternal(element);
            var callParticipants = participantsUpdatedEventInternal.Participants?.Select(x => new CallParticipant(identifier: CommunicationIdentifierSerializer.Deserialize(x.Identifier), isMuted: x.IsMuted, participantId: x.ParticipantId));

            return(new ParticipantsUpdatedEvent(participantsUpdatedEventInternal.CallConnectionId, callParticipants));
        }
Exemple #2
0
        /// <summary>
        /// Deserialize <see cref="ParticipantsUpdatedEvent"/> event.
        /// </summary>
        /// <param name="content">The json content.</param>
        /// <returns>The new <see cref="ParticipantsUpdatedEvent"/> object.</returns>
        public static ParticipantsUpdatedEvent Deserialize(string content)
        {
            using var document = JsonDocument.Parse(content);
            JsonElement element = document.RootElement;

            var participantsUpdatedEventInternal = ParticipantsUpdatedEventInternal.DeserializeParticipantsUpdatedEventInternal(element);

            return(new ParticipantsUpdatedEvent
            {
                CallLegId = participantsUpdatedEventInternal.CallLegId,
                Participants = participantsUpdatedEventInternal.Participants?.Select(x => new CommunicationParticipant {
                    Identifier = CommunicationIdentifierSerializer.Deserialize(x.Identifier), IsMuted = x.IsMuted, ParticipantId = x.ParticipantId
                })
            });
        }