forked from CrustyJew/RedditSharp-DEPRECATED-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMData.cs
More file actions
127 lines (110 loc) · 3.84 KB
/
MData.cs
File metadata and controls
127 lines (110 loc) · 3.84 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
namespace RedditSharp.Multi
{
/// <summary>
/// Contains the innner information of the Multi
/// </summary>
public class MData : RedditObject
{
/// <summary>
/// Can the Multi be edited
/// </summary>
[JsonProperty("can_edit")]
public bool CanEdit { get; private set; }
/// <summary>
/// Display name for the Multi
/// </summary>
[JsonProperty("display_name")]
public string DisplayName { get; private set; }
/// <summary>
/// Actual name of the Multi
/// </summary>
[JsonProperty("name")]
public string Name { get; private set; }
/// <summary>
/// Description of the Multi in HTML format
/// </summary>
[JsonProperty("description_html")]
public string DescriptionHTML { get; private set; }
/// <summary>
/// When the multi was created
/// </summary>
[JsonProperty("created")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTime? Created { get; private set; }
/// <summary>
/// Where the multi was copied from if it was copied
/// </summary>
[JsonProperty("copied_from")]
public string CopiedFrom { get; private set; }
/// <summary>
/// URL of the icon to use.
/// </summary>
[JsonProperty("icon_url")]
public string IconUrl { get; private set; }
/// <summary>
/// List of the Subreddits in the multi
/// </summary>
[JsonIgnore]
public List<MultiSubs> Subreddits { get; private set; }
/// <summary>
/// When the multi was created in UTC
/// </summary>
[JsonProperty("created_utc")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTime? CreatedUTC { get; private set; }
/// <summary>
/// Hex Code of the color for the multi
/// </summary>
[JsonProperty("key_color")]
public string KeyColor { get; private set; }
/// <summary>
/// Visiblity property for the Multi
/// </summary>
[JsonProperty("visibility")]
public string Visibility { get; private set; }
/// <summary>
/// Name of the icon corresponding to the URL
/// </summary>
[JsonProperty("icon_name")]
public string IconName { get; private set; }
/// <summary>
/// Weighting scheme of the Multi
/// </summary>
[JsonProperty("weighting_scheme")]
public string WeightingScheme { get; private set; }
/// <summary>
/// Path to navigate to the multi
/// </summary>
[JsonProperty("path")]
public string Path { get; private set; }
/// <summary>
/// Description of the multi in text format.
/// </summary>
[JsonProperty("description_md")]
public string DescriptionMD { get; private set; }
/// <summary>
/// Creates a new mData implementation
/// </summary>
/// <param name="agent">WebAgent object to use</param>
/// <param name="json">Token to use with parameters for the different members</param>
/// <param name="subs">Whether or not subs exist</param>
protected internal MData(IWebAgent agent, JToken json, bool subs) : base(agent)
{
Subreddits = new List<MultiSubs>();
if (subs)
{
//Get Subreddit List
for (int i = 0; i < json["subreddits"].Count(); i++)
{
Subreddits.Add(new MultiSubs(agent, json["subreddits"][i]));
}
}
Helpers.PopulateObject(json, this);
}
}
}