internal static ChatParticipantsCollection DeserializeChatParticipantsCollection(JsonElement element) { Optional <IReadOnlyList <ChatParticipantInternal> > value = default; Optional <string> nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ChatParticipantInternal> array = new List <ChatParticipantInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ChatParticipantInternal.DeserializeChatParticipantInternal(item)); } value = array; continue; } if (property.NameEquals("nextLink")) { nextLink = property.Value.GetString(); continue; } } return(new ChatParticipantsCollection(Optional.ToList(value), nextLink.Value)); }
internal static ChatMessageContentInternal DeserializeChatMessageContentInternal(JsonElement element) { Optional <string> message = default; Optional <string> topic = default; Optional <IReadOnlyList <ChatParticipantInternal> > participants = default; Optional <CommunicationIdentifierModel> initiatorCommunicationIdentifier = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("message")) { message = property.Value.GetString(); continue; } if (property.NameEquals("topic")) { topic = property.Value.GetString(); continue; } if (property.NameEquals("participants")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ChatParticipantInternal> array = new List <ChatParticipantInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ChatParticipantInternal.DeserializeChatParticipantInternal(item)); } participants = array; continue; } if (property.NameEquals("initiatorCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } initiatorCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } } return(new ChatMessageContentInternal(message.Value, topic.Value, Optional.ToList(participants), initiatorCommunicationIdentifier.Value)); }
internal ChatParticipant(ChatParticipantInternal chatParticipantInternal) { User = CommunicationIdentifierSerializer.Deserialize(chatParticipantInternal.CommunicationIdentifier); DisplayName = chatParticipantInternal.DisplayName; ShareHistoryTime = chatParticipantInternal.ShareHistoryTime; }
internal ChatParticipant(ChatParticipantInternal chatParticipantInternal) { User = new CommunicationUserIdentifier(chatParticipantInternal.Id); DisplayName = chatParticipantInternal.DisplayName; ShareHistoryTime = chatParticipantInternal.ShareHistoryTime; }
internal static ChatThreadInternal DeserializeChatThreadInternal(JsonElement element) { Optional <string> id = default; Optional <string> topic = default; Optional <DateTimeOffset> createdOn = default; Optional <string> createdBy = default; Optional <DateTimeOffset> deletedOn = default; Optional <IReadOnlyList <ChatParticipantInternal> > participants = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("topic")) { topic = property.Value.GetString(); continue; } if (property.NameEquals("createdOn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdOn = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("createdBy")) { createdBy = property.Value.GetString(); continue; } if (property.NameEquals("deletedOn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } deletedOn = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("participants")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ChatParticipantInternal> array = new List <ChatParticipantInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ChatParticipantInternal.DeserializeChatParticipantInternal(item)); } participants = array; continue; } } return(new ChatThreadInternal(id.Value, topic.Value, Optional.ToNullable(createdOn), createdBy.Value, Optional.ToNullable(deletedOn), Optional.ToList(participants))); }