From 9b1e5d139f7c4677b2937dc46f409c3dac2f9589 Mon Sep 17 00:00:00 2001 From: Robert Linde Date: Tue, 17 Oct 2017 13:21:47 +0200 Subject: [PATCH 1/2] Add specific type for references --- Contentful.Core/Models/Management/Reference.cs | 18 ++++++++++++++++++ .../Models/Management/SystemLinkTypes.cs | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Contentful.Core/Models/Management/Reference.cs diff --git a/Contentful.Core/Models/Management/Reference.cs b/Contentful.Core/Models/Management/Reference.cs new file mode 100644 index 0000000..acb069f --- /dev/null +++ b/Contentful.Core/Models/Management/Reference.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Contentful.Core.Models.Management +{ + public class Reference + { + public string Sys { get; set; } + } + + public class ReferenceProperties + { + public string Type => "Link"; + public string LinkType { get; set; } + public string Id { get; set; } + } +} diff --git a/Contentful.Core/Models/Management/SystemLinkTypes.cs b/Contentful.Core/Models/Management/SystemLinkTypes.cs index 949ecf0..50f17a8 100644 --- a/Contentful.Core/Models/Management/SystemLinkTypes.cs +++ b/Contentful.Core/Models/Management/SystemLinkTypes.cs @@ -13,9 +13,20 @@ public class SystemLinkTypes /// A reference to an entry. /// public const string Entry = "Entry"; + /// /// A reference to an asset. /// public const string Asset = "Asset"; + + /// + /// A reference to a space. + /// + public const string Space = "Space"; + + /// + /// A reference to a contenttype. + /// + public const string ContentType = "ContentType"; } } \ No newline at end of file From cbfb916d5276959426490a5a1bfcde151adefad3 Mon Sep 17 00:00:00 2001 From: Robert Linde Date: Tue, 17 Oct 2017 13:53:50 +0200 Subject: [PATCH 2/2] Increase package version and dependency --- .../Contentful.AspNetCore.csproj | 6 ++--- Contentful.Core/Contentful.Core.csproj | 8 +++---- .../Models/Management/Reference.cs | 23 ++++++++++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Contentful.AspNetCore/Contentful.AspNetCore.csproj b/Contentful.AspNetCore/Contentful.AspNetCore.csproj index 9c5c82c..3cf15e1 100644 --- a/Contentful.AspNetCore/Contentful.AspNetCore.csproj +++ b/Contentful.AspNetCore/Contentful.AspNetCore.csproj @@ -3,7 +3,7 @@ Official .NET SDK for the Contentful Content Delivery and Management API for ASP.NET core. contentful.aspnetcore en-US - 1.4.2 + 1.5.0 netstandard1.6 Contentful Contentful GmbH. @@ -14,13 +14,13 @@ https://github.com/contentful/contentful.net/master/LICENSE git git://github.com/contentful/contentful.net - 1.4.2 + 1.5.0 bin\Release\netstandard1.5\Contentful.AspNetCore.xml - + diff --git a/Contentful.Core/Contentful.Core.csproj b/Contentful.Core/Contentful.Core.csproj index 99865f4..1b19b3b 100644 --- a/Contentful.Core/Contentful.Core.csproj +++ b/Contentful.Core/Contentful.Core.csproj @@ -4,7 +4,7 @@ contentful.csharp contentful.net en-US - 1.4.1 + 1.5.0 netstandard1.4 Contentful Contentful GmbH. @@ -18,9 +18,9 @@ false false false - 1.4.1.0 - 1.4.1.0 - 1.4.1 + 1.5.0.0 + 1.5.0.0 + 1.5.0 diff --git a/Contentful.Core/Models/Management/Reference.cs b/Contentful.Core/Models/Management/Reference.cs index acb069f..7bdfa12 100644 --- a/Contentful.Core/Models/Management/Reference.cs +++ b/Contentful.Core/Models/Management/Reference.cs @@ -4,15 +4,36 @@ namespace Contentful.Core.Models.Management { + /// + /// Represents a reference link returned from the Contentful API. + /// Allows you to easily model reference fields when creating new entries. + /// public class Reference { - public string Sys { get; set; } + /// + /// The properties for this reference. + /// + public ReferenceProperties Sys { get; set; } } + /// + /// Encapsulates the three properties that a consists of. + /// public class ReferenceProperties { + /// + /// The type of object, for references this is always "Link". + /// public string Type => "Link"; + + /// + /// The type of link. Normally one of . + /// public string LinkType { get; set; } + + /// + /// The if of the item which is being referenced. + /// public string Id { get; set; } } }