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
137 lines (119 loc) · 4 KB
/
MData.cs
File metadata and controls
137 lines (119 loc) · 4 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
128
129
130
131
132
133
134
135
136
137
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RedditSharp.Multi
{
/// <summary>
/// Contains the innner information of the Multi
/// </summary>
public class MData
{
/// <summary>
/// Can the Multi be edited
/// </summary>
[JsonProperty("can_edit")]
public bool CanEdit { get; set; }
/// <summary>
/// Display name for the Multi
/// </summary>
[JsonProperty("display_name")]
public string DisplayName { get; set; }
/// <summary>
/// Actual name of the Multi
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Description of the Multi in HTML format
/// </summary>
[JsonProperty("description_html")]
public string DescriptionHTML { get; set; }
/// <summary>
/// When the multi was created
/// </summary>
[JsonProperty("created")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTimeOffset? Created { get; set; }
/// <summary>
/// Where the multi was copied from if it was copied
/// </summary>
[JsonProperty("copied_from")]
public string CopiedFrom { get; set; }
/// <summary>
/// URL of the icon to use.
/// </summary>
[JsonProperty("icon_url")]
public string IconUrl { get; set; }
/// <summary>
/// List of the Subreddits in the multi
/// </summary>
[JsonIgnore]
public List<MultiSubs> Subreddits { get; set; }
/// <summary>
/// When the multi was created in UTC
/// </summary>
[JsonProperty("created_utc")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTimeOffset? CreatedUTC { get; set; }
/// <summary>
/// Hex Code of the color for the multi
/// </summary>
[JsonProperty("key_color")]
public string KeyColor { get; set; }
/// <summary>
/// Visiblity property for the Multi
/// </summary>
[JsonProperty("visibility")]
public string Visibility { get; set; }
/// <summary>
/// Name of the icon corresponding to the URL
/// </summary>
[JsonProperty("icon_name")]
public string IconName { get; set; }
/// <summary>
/// Weighting scheme of the Multi
/// </summary>
[JsonProperty("weighting_scheme")]
public string WeightingScheme { get; set; }
/// <summary>
/// Path to navigate to the multi
/// </summary>
[JsonProperty("path")]
public string Path { get; set; }
/// <summary>
/// Description of the multi in text format.
/// </summary>
[JsonProperty("description_md")]
public string DescriptionMD { get; set; }
/// <summary>
/// Creates a new mData implementation
/// </summary>
/// <param name="reddit">Reddit object to use</param>
/// <param name="json">Token to use with parameters for the different members</param>
/// <param name="webAgent">Web Agent to use</param>
/// <param name="subs">Whether or not subs exist</param>
protected internal MData(Reddit reddit, JToken json, IWebAgent webAgent, bool subs)
{
Subreddits = new List<MultiSubs>();
if (subs)
{
//Get Subreddit List
for (int i = 0; i < json["subreddits"].Count(); i++)
{
Subreddits.Add(new MultiSubs(reddit, json["subreddits"][i], webAgent));
}
}
JsonConvert.PopulateObject(json.ToString(), this, reddit.JsonSerializerSettings);
}
/// <summary>
/// Generic Constructor
/// </summary>
public MData()
{
}
}
}