Reference.cs
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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>
/// Initializes a new Reference.
/// </summary>
public Reference()
{
}
/// <summary>
/// Initializes a new Reference.
/// </summary>
/// <param name="linkType">The linktype of the reference. Normally one of <see cref="SystemLinkTypes"/>.</param>
/// <param name="id">The id of the item which is being referenced.</param>
public Reference(string linkType, string id)
{
Sys = new ReferenceProperties
{
LinkType = linkType,
Id = id
};
}
/// <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 id of the item which is being referenced.
/// </summary>
public string Id { get; set; }
}
}