Created
May 1, 2017 12:11
-
-
Save bhameyie/d43043b553576259de4b4f19705bb77f to your computer and use it in GitHub Desktop.
Sample description of HAL extension idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum LinkKind | |
{ | |
Fetch, | |
Save, | |
Update | |
} | |
public enum Restrictions | |
{ | |
Required, | |
Optional | |
} | |
public class ActionableLink | |
{ | |
public string Href { get; set; } | |
[JsonConverter(typeof(StringEnumConverter))] | |
public LinkKind Kind { get; set; } | |
public string Name { get; set; } | |
} | |
public class PresentableField | |
{ | |
public PresentableField() | |
{ | |
Restrictions = new Restrictions[0]; | |
} | |
[JsonProperty(ItemConverterType = typeof(StringEnumConverter))] | |
public IEnumerable<Restrictions> Restrictions { get; set; } | |
public string BoundTo { get; set; } | |
public bool Editable { get; set; } | |
public string Name { get; set; } | |
} | |
public class Presentable | |
{ | |
public Presentable() | |
{ | |
Fields = new PresentableField[0]; | |
} | |
public IEnumerable<PresentableField> Fields { get; set; } | |
public string ActionBoundTo { get; set; } | |
} | |
public class Metadata | |
{ | |
public string ObjectName { get; set; } | |
public string Description { get; set; } | |
} | |
public abstract class ExtendedModel | |
{ | |
public ExtendedModel() | |
{ | |
Links = new Dictionary<string,IEnumerable<ActionableLink>>(); | |
} | |
[JsonPropertyAttribute("_links")] | |
public Dictionary<string,IEnumerable<ActionableLink>> Links { get; set; } | |
[JsonPropertyAttribute("_presentable")] | |
public Presentable Presentable { get; set; } | |
[JsonPropertyAttribute("_metadata")] | |
public Metadata Metadata { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment