-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathResourceObject.cs
More file actions
32 lines (30 loc) · 1.19 KB
/
ResourceObject.cs
File metadata and controls
32 lines (30 loc) · 1.19 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
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace JSONAPI.Documents
{
/// <summary>
/// Default implementation of IResourceObject
/// </summary>
public class ResourceObject : IResourceObject
{
public string Type { get; private set; }
public string Id { get; private set; }
public IDictionary<string, JToken> Attributes { get; private set; }
public IDictionary<string, IRelationshipObject> Relationships { get; private set; }
public ILink SelfLink { get; private set; }
public IMetadata Metadata { get; private set; }
/// <summary>
/// Creates a ResourceObject
/// </summary>
public ResourceObject(string type, string id, IDictionary<string, JToken> attributes = null,
IDictionary<string, IRelationshipObject> relationships = null, ILink selfLink = null, IMetadata metadata = null)
{
Type = type;
Id = id;
Attributes = attributes ?? new Dictionary<string, JToken>();
Relationships = relationships ?? new Dictionary<string, IRelationshipObject>();
SelfLink = selfLink;
Metadata = metadata;
}
}
}