diff --git a/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItem.cs b/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItem.cs index 091c52b4..ea08ef70 100644 --- a/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItem.cs +++ b/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItem.cs @@ -7,30 +7,7 @@ namespace Kontent.Ai.Delivery.Abstractions; /// public interface ISyncItem { - /// - /// Gets the content item's codename. - /// - string Codename { get; } - - /// - /// Gets the content item's internal ID. - /// - Guid Id { get; } - - /// - /// Gets the content item's type codename. - /// - string Type { get; } - - /// - /// Gets the codename of the language that the content is in. - /// - string Language { get; } - - /// - /// Gets the content item's collection codename. For projects without collections enabled, the value is default. - /// - string Collection { get; } + ISyncItemData Data { get; } /// /// Gets the information whether the content item was modified or deleted since the last synchronization. diff --git a/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItemData.cs b/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItemData.cs new file mode 100644 index 00000000..971c1b63 --- /dev/null +++ b/Kontent.Ai.Delivery.Abstractions/Sync/ISyncItemData.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Kontent.Ai.Delivery.Abstractions; + +/// +/// Represents a delta update. +/// +public interface ISyncItemData +{ + IContentItemSystemAttributes System { get; } + object Elements { get; } +} \ No newline at end of file diff --git a/Kontent.Ai.Delivery/Sync/SyncItem.cs b/Kontent.Ai.Delivery/Sync/SyncItem.cs index 319010bb..945ea4c3 100644 --- a/Kontent.Ai.Delivery/Sync/SyncItem.cs +++ b/Kontent.Ai.Delivery/Sync/SyncItem.cs @@ -1,45 +1,27 @@ using System; +using System.Collections.Generic; using Kontent.Ai.Delivery.Abstractions; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace Kontent.Ai.Delivery.Sync; /// -public class SyncItem : ISyncItem +internal sealed class SyncItem : ISyncItem { - /// - [JsonProperty("codename")] - public string Codename { get; internal set; } + [JsonProperty("data")] + public ISyncItemData Data { get; internal set; } - /// - [JsonProperty("id")] - public Guid Id { get; internal set; } - - /// - [JsonProperty("type")] - public string Type { get; internal set; } - - /// - [JsonProperty("language")] - public string Language { get; internal set; } - - /// - [JsonProperty("collection")] - public string Collection { get; internal set; } - - /// [JsonProperty("change_type")] public string ChangeType { get; internal set; } - /// [JsonProperty("timestamp")] public DateTime Timestamp { get; internal set; } - /// - /// Constructor used for deserialization (e.g. for caching purposes), contains no logic. - /// [JsonConstructor] - public SyncItem() - { + public SyncItem(ISyncItemData data, string changeType, DateTime timestamp) { + Data = data; + ChangeType = changeType; + Timestamp = timestamp; } } \ No newline at end of file diff --git a/Kontent.Ai.Delivery/Sync/SyncItemData.cs b/Kontent.Ai.Delivery/Sync/SyncItemData.cs new file mode 100644 index 00000000..ea0966a7 --- /dev/null +++ b/Kontent.Ai.Delivery/Sync/SyncItemData.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; +using Kontent.Ai.Delivery.Abstractions; +using Kontent.Ai.Delivery.ContentTypes.Element; +using Newtonsoft.Json; + +namespace Kontent.Ai.Delivery.Sync +{ + public class SyncItemData : ISyncItemData + { + [JsonProperty("system")] + public IContentItemSystemAttributes System { get; internal set; } + + [JsonProperty("elements")] + public object Elements { get; internal set; } + + [JsonConstructor] + public SyncItemData() + { + } + } +} \ No newline at end of file