Skip to content

Commit

Permalink
Add support for content type metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Roblinde committed Jun 15, 2023
1 parent 0b83870 commit 02d52e7
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Contentful.AspNetCore/Contentful.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Description>Official .NET SDK for the Contentful Content Delivery and Management API for ASP.NET core.</Description>
<PackageId>contentful.aspnetcore</PackageId>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>7.2.5</VersionPrefix>
<VersionPrefix>7.2.6</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>Contentful</Authors>
<Copyright>Contentful GmbH.</Copyright>
Expand All @@ -13,10 +13,10 @@
<PackageProjectUrl>https://github.com/contentful/contentful.net</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<Version>7.2.5</Version>
<AssemblyVersion>7.2.5.0</AssemblyVersion>
<Version>7.2.6</Version>
<AssemblyVersion>7.2.6.0</AssemblyVersion>
<RepositoryUrl>https://github.com/contentful/contentful.net</RepositoryUrl>
<FileVersion>7.2.5.0</FileVersion>
<FileVersion>7.2.6.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netstandard1.5\Contentful.AspNetCore.xml</DocumentationFile>
Expand All @@ -25,7 +25,7 @@
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="contentful.csharp" Version="7.2.5" />
<PackageReference Include="contentful.csharp" Version="7.2.6" />
<PackageReference Include="gitlink" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Contentful.Core/Contentful.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageId>contentful.csharp</PackageId>
<AssemblyTitle>contentful.net</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>7.2.5</VersionPrefix>
<VersionPrefix>7.2.6</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>Contentful</Authors>
<Copyright>Contentful GmbH.</Copyright>
Expand Down
7 changes: 7 additions & 0 deletions Contentful.Core/Models/ContentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Contentful.Core.Models.Management;
using Newtonsoft.Json;

namespace Contentful.Core.Models
Expand All @@ -17,6 +18,12 @@ public class ContentType : IContentfulResource
[JsonProperty("sys")]
public SystemProperties SystemProperties { get; set; }

/// <summary>
/// Metadata properties for the content type.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public ContentTypeMetadata Metadata { get; set; }

/// <summary>
/// The name of the content type.
/// </summary>
Expand Down
31 changes: 31 additions & 0 deletions Contentful.Core/Models/Management/ContentTypeMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Contentful.Core.Models.Management
{
/// <summary>
/// Represents a Contentful metadata object for this content type.
/// </summary>
public class ContentTypeMetadata
{
/// <summary>
/// The metadata annotations
/// </summary>
public ContentTypeMetadataAnnotation Annotations { get; set; }
}

public class ContentTypeMetadataAnnotation
{
/// <summary>
/// Annotations for the content type.
/// </summary>
public List<Reference> ContentType { get; set; } = new List<Reference>();

/// <summary>
/// Annotations for the content type fields.
/// </summary>
public dynamic ContentTypeField { get; set; }
}
}

5 changes: 5 additions & 0 deletions Contentful.Core/Models/Management/SystemLinkTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class SystemLinkTypes
/// A reference to a status object.
/// </summary>
public const string Status = "Status";

/// <summary>
/// An annotation reference for ContentTypes
/// </summary>
public const string Annotation = "Annotation";

/// <summary>
/// A reference to an entry.
Expand Down

0 comments on commit 02d52e7

Please sign in to comment.