-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathDocumentCollection.cs
More file actions
62 lines (55 loc) · 2.03 KB
/
DocumentCollection.cs
File metadata and controls
62 lines (55 loc) · 2.03 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
62
using System.Collections;
using System.Runtime.Serialization;
namespace Lime.Protocol
{
/// <summary>
/// Represents a collection of documents.
/// </summary>
[DataContract(Namespace = "http://limeprotocol.org/2014")]
public class DocumentCollection : Document, IEnumerable
{
public const string MIME_TYPE = "application/vnd.lime.collection+json";
public const string TOTAL_KEY = "total";
public const string ITEM_TYPE_KEY = "itemType";
public const string ITEMS_KEY = "items";
/// <summary>
/// Initializes a new instance of the <see cref="DocumentCollection"/> class.
/// </summary>
public DocumentCollection()
: base(MediaType.Parse(MIME_TYPE))
{
}
/// <summary>
/// Gets or sets the total of items in the collection.
/// The count refers to the original source collection, without any applied filter that may be applied in the items on this collection.
/// </summary>
/// <value>
/// The total.
/// </value>
[DataMember(Name = TOTAL_KEY, EmitDefaultValue = false)]
public int Total { get; set; }
/// <summary>
/// Gets or sets the media type of all items of the collection..
/// </summary>
/// <value>
/// The type of the item.
/// </value>
[DataMember(Name = ITEM_TYPE_KEY)]
public MediaType ItemType { get; set; }
/// <summary>
/// Gets or sets the collection items.
/// </summary>
/// <value>
/// The items.
/// </value>
[DataMember(Name = ITEMS_KEY)]
public Document[] Items { get; set; }
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
/// </returns>
public IEnumerator GetEnumerator() => Items?.GetEnumerator();
}
}