internal static AcsChatThreadParticipantProperties DeserializeAcsChatThreadParticipantProperties(JsonElement element) { Optional <string> displayName = default; Optional <CommunicationIdentifierModel> participantCommunicationIdentifier = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayName")) { displayName = property.Value.GetString(); continue; } if (property.NameEquals("participantCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } participantCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } } return(new AcsChatThreadParticipantProperties(displayName.Value, participantCommunicationIdentifier.Value)); }
internal static AcsChatEventBaseProperties DeserializeAcsChatEventBaseProperties(JsonElement element) { Optional <CommunicationIdentifierModel> recipientCommunicationIdentifier = default; Optional <string> transactionId = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("recipientCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("transactionId")) { transactionId = property.Value.GetString(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatEventBaseProperties(recipientCommunicationIdentifier.Value, transactionId.Value, threadId.Value)); }
internal static AcsChatThreadDeletedEventData DeserializeAcsChatThreadDeletedEventData(JsonElement element) { Optional <CommunicationIdentifierModel> deletedByCommunicationIdentifier = default; Optional <DateTimeOffset> deleteTime = default; Optional <DateTimeOffset> createTime = default; Optional <long> version = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deletedByCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } deletedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("deleteTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } deleteTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("createTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("version")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } version = property.Value.GetInt64(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatThreadDeletedEventData(threadId.Value, Optional.ToNullable(createTime), Optional.ToNullable(version), deletedByCommunicationIdentifier.Value, Optional.ToNullable(deleteTime))); }
internal static AcsChatParticipantAddedToThreadEventData DeserializeAcsChatParticipantAddedToThreadEventData(JsonElement element) { Optional <DateTimeOffset> time = default; Optional <CommunicationIdentifierModel> addedByCommunicationIdentifier = default; Optional <AcsChatThreadParticipantProperties> participantAdded = default; Optional <long> version = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("time")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } time = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("addedByCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } addedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("participantAdded")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } participantAdded = AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(property.Value); continue; } if (property.NameEquals("version")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } version = property.Value.GetInt64(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatParticipantAddedToThreadEventData(threadId.Value, Optional.ToNullable(time), addedByCommunicationIdentifier.Value, participantAdded.Value, Optional.ToNullable(version))); }
internal static AcsUserDisconnectedEventData DeserializeAcsUserDisconnectedEventData(JsonElement element) { Optional <CommunicationIdentifierModel> userCommunicationIdentifier = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } userCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } } return(new AcsUserDisconnectedEventData(userCommunicationIdentifier.Value)); }
internal static AcsChatMessageEventInThreadBaseProperties DeserializeAcsChatMessageEventInThreadBaseProperties(JsonElement element) { Optional <string> messageId = default; Optional <CommunicationIdentifierModel> senderCommunicationIdentifier = default; Optional <string> senderDisplayName = default; Optional <DateTimeOffset> composeTime = default; Optional <string> type = default; Optional <long> version = default; Optional <string> transactionId = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("messageId")) { messageId = property.Value.GetString(); continue; } if (property.NameEquals("senderCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("senderDisplayName")) { senderDisplayName = property.Value.GetString(); continue; } if (property.NameEquals("composeTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } composeTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("version")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } version = property.Value.GetInt64(); continue; } if (property.NameEquals("transactionId")) { transactionId = property.Value.GetString(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatMessageEventInThreadBaseProperties(transactionId.Value, threadId.Value, messageId.Value, senderCommunicationIdentifier.Value, senderDisplayName.Value, Optional.ToNullable(composeTime), type.Value, Optional.ToNullable(version))); }
internal static AcsChatThreadCreatedEventData DeserializeAcsChatThreadCreatedEventData(JsonElement element) { Optional <CommunicationIdentifierModel> createdByCommunicationIdentifier = default; Optional <IReadOnlyDictionary <string, object> > properties = default; Optional <IReadOnlyList <AcsChatThreadParticipantProperties> > participants = default; Optional <DateTimeOffset> createTime = default; Optional <long> version = default; Optional <string> transactionId = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("createdByCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetObject()); } properties = dictionary; continue; } if (property.NameEquals("participants")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <AcsChatThreadParticipantProperties> array = new List <AcsChatThreadParticipantProperties>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(item)); } participants = array; continue; } if (property.NameEquals("createTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("version")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } version = property.Value.GetInt64(); continue; } if (property.NameEquals("transactionId")) { transactionId = property.Value.GetString(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatThreadCreatedEventData(transactionId.Value, threadId.Value, Optional.ToNullable(createTime), Optional.ToNullable(version), createdByCommunicationIdentifier.Value, Optional.ToDictionary(properties), Optional.ToList(participants))); }
internal static AcsChatMessageEditedEventData DeserializeAcsChatMessageEditedEventData(JsonElement element) { Optional <string> messageBody = default; Optional <IReadOnlyDictionary <string, string> > metadata = default; Optional <DateTimeOffset> editTime = default; Optional <string> messageId = default; Optional <CommunicationIdentifierModel> senderCommunicationIdentifier = default; Optional <string> senderDisplayName = default; Optional <DateTimeOffset> composeTime = default; Optional <string> type = default; Optional <long> version = default; Optional <CommunicationIdentifierModel> recipientCommunicationIdentifier = default; Optional <string> transactionId = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("messageBody")) { messageBody = property.Value.GetString(); continue; } if (property.NameEquals("metadata")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } metadata = dictionary; continue; } if (property.NameEquals("editTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } editTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("messageId")) { messageId = property.Value.GetString(); continue; } if (property.NameEquals("senderCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("senderDisplayName")) { senderDisplayName = property.Value.GetString(); continue; } if (property.NameEquals("composeTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } composeTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("version")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } version = property.Value.GetInt64(); continue; } if (property.NameEquals("recipientCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("transactionId")) { transactionId = property.Value.GetString(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatMessageEditedEventData(recipientCommunicationIdentifier.Value, transactionId.Value, threadId.Value, messageId.Value, senderCommunicationIdentifier.Value, senderDisplayName.Value, Optional.ToNullable(composeTime), type.Value, Optional.ToNullable(version), messageBody.Value, Optional.ToDictionary(metadata), Optional.ToNullable(editTime))); }
internal static AcsChatThreadPropertiesUpdatedPerUserEventData DeserializeAcsChatThreadPropertiesUpdatedPerUserEventData(JsonElement element) { Optional <CommunicationIdentifierModel> editedByCommunicationIdentifier = default; Optional <DateTimeOffset> editTime = default; Optional <IReadOnlyDictionary <string, object> > properties = default; Optional <DateTimeOffset> createTime = default; Optional <long> version = default; Optional <CommunicationIdentifierModel> recipientCommunicationIdentifier = default; Optional <string> transactionId = default; Optional <string> threadId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("editedByCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } editedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("editTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } editTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetObject()); } properties = dictionary; continue; } if (property.NameEquals("createTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("version")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } version = property.Value.GetInt64(); continue; } if (property.NameEquals("recipientCommunicationIdentifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } if (property.NameEquals("transactionId")) { transactionId = property.Value.GetString(); continue; } if (property.NameEquals("threadId")) { threadId = property.Value.GetString(); continue; } } return(new AcsChatThreadPropertiesUpdatedPerUserEventData(recipientCommunicationIdentifier.Value, transactionId.Value, threadId.Value, Optional.ToNullable(createTime), Optional.ToNullable(version), editedByCommunicationIdentifier.Value, Optional.ToNullable(editTime), Optional.ToDictionary(properties))); }