Skip to content

Commit

Permalink
Merge pull request #121 from contentful/feature/add-reference-type
Browse files Browse the repository at this point in the history
Feature/add reference type
  • Loading branch information
Roblinde authored Oct 17, 2017
2 parents a76eea3 + cbfb916 commit 4515c18
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
6 changes: 3 additions & 3 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>1.4.2</VersionPrefix>
<VersionPrefix>1.5.0</VersionPrefix>
<TargetFramework>netstandard1.6</TargetFramework>
<Authors>Contentful</Authors>
<Copyright>Contentful GmbH.</Copyright>
Expand All @@ -14,13 +14,13 @@
<PackageLicenseUrl>https://github.com/contentful/contentful.net/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/contentful/contentful.net</RepositoryUrl>
<Version>1.4.2</Version>
<Version>1.5.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netstandard1.5\Contentful.AspNetCore.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="contentful.csharp" Version="1.4.1" />
<PackageReference Include="contentful.csharp" Version="1.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Razor" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="1.1.2" />
Expand Down
8 changes: 4 additions & 4 deletions 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>1.4.1</VersionPrefix>
<VersionPrefix>1.5.0</VersionPrefix>
<TargetFramework>netstandard1.4</TargetFramework>
<Authors>Contentful</Authors>
<Copyright>Contentful GmbH.</Copyright>
Expand All @@ -18,9 +18,9 @@
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<FileVersion>1.4.1.0</FileVersion>
<Version>1.4.1</Version>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<FileVersion>1.5.0.0</FileVersion>
<Version>1.5.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options">
Expand Down
39 changes: 39 additions & 0 deletions Contentful.Core/Models/Management/Reference.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Contentful.Core.Models.Management
{
/// <summary>
/// Represents a reference link returned from the Contentful API.
/// Allows you to easily model reference fields when creating new entries.
/// </summary>
public class Reference
{
/// <summary>
/// The properties for this reference.
/// </summary>
public ReferenceProperties Sys { get; set; }
}

/// <summary>
/// Encapsulates the three properties that a <see cref="Reference"/> consists of.
/// </summary>
public class ReferenceProperties
{
/// <summary>
/// The type of object, for references this is always "Link".
/// </summary>
public string Type => "Link";

/// <summary>
/// The type of link. Normally one of <see cref="SystemLinkTypes"/>.
/// </summary>
public string LinkType { get; set; }

/// <summary>
/// The if of the item which is being referenced.
/// </summary>
public string Id { get; set; }
}
}
11 changes: 11 additions & 0 deletions Contentful.Core/Models/Management/SystemLinkTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,20 @@ public class SystemLinkTypes
/// A reference to an entry.
/// </summary>
public const string Entry = "Entry";

/// <summary>
/// A reference to an asset.
/// </summary>
public const string Asset = "Asset";

/// <summary>
/// A reference to a space.
/// </summary>
public const string Space = "Space";

/// <summary>
/// A reference to a contenttype.
/// </summary>
public const string ContentType = "ContentType";
}
}

0 comments on commit 4515c18

Please sign in to comment.