-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Post.cs
144 lines (131 loc) · 3.62 KB
/
Post.cs
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
138
139
140
141
142
143
144
namespace BooruDex.Models
{
/// <summary>
/// Represents a Post object.
/// </summary>
public class Post
{
/// <summary>
/// Initialize <see cref="Post"/> instance.
/// </summary>
/// <param name="id">
/// The ID of the <see cref="Post"/>.
/// </param>
/// <param name="postUrl">
/// The URL of the <see cref="Post"/>.
/// </param>
/// <param name="fileUrl">
/// The URL of the file.
/// </param>
/// <param name="previewUrl">
/// The URL of the preview image.
/// </param>
/// <param name="rating">
/// The <see cref="Post"/>'s <see cref="Rating"/>.
/// </param>
/// <param name="tags">
/// The array containing all the <see cref="Tag"/> associated with the file.
/// </param>
/// <param name="size">
/// The size of the file, in bytes.
/// </param>
/// <param name="height">
/// The height of the image, in pixels.
/// </param>
/// <param name="width">
/// The width of the image, in pixels.
/// </param>
/// <param name="previewHeight">
/// The height of the preview image, in pixels.
/// </param>
/// <param name="previewWidth">
/// The width of the preview image, in pixels.
/// </param>
/// <param name="source">
/// The URL of the original file.
/// </param>
public Post(
uint id = 0,
string postUrl = "",
string fileUrl = "",
string previewUrl = "",
Rating rating = Rating.None,
string tags = "",
uint size = 0,
int height = 0,
int width = 0,
int? previewHeight = 0,
int? previewWidth = 0,
string source = "")
{
this.ID = id;
this.FileUrl = fileUrl;
this.PreviewUrl = previewUrl;
this.PostUrl = postUrl + this.ID;
this.Rating = rating;
this.Tags = tags;
this.Size = size;
this.Height = height;
this.Width = width;
this.PreviewHeight = previewHeight;
this.PreviewWidth = previewWidth;
this.Source = source;
}
/// <summary>
/// Gets the ID of the post.
/// </summary>
public uint ID { internal set; get; }
/// <summary>
/// Gets the URI of the <see cref="Post"/>.
/// </summary>
public string PostUrl { internal set; get; }
/// <summary>
/// Gets the URL of the file.
/// </summary>
public string FileUrl { internal set; get; }
/// <summary>
/// Gets the URL of the preview image.
/// </summary>
public string PreviewUrl { internal set; get; }
/// <summary>
/// Gets the <see cref="Post"/>'s <see cref="Rating"/>.
/// </summary>
public Rating Rating { internal set; get; }
/// <summary>
/// Gets the collection containing all the <see cref="Tag"/> associated with the file.
/// </summary>
public string Tags { internal set; get; }
/// <summary>
/// Gets the size of the file, in bytes, or
/// <see langword="null"/> if file size is unknown.
/// </summary>
public uint Size { internal set; get; }
/// <summary>
/// Gets the height of the image, in pixels.
/// </summary>
public int Height { internal set; get; }
/// <summary>
/// Gets the width of the image, in pixels.
/// </summary>
public int Width { internal set; get; }
/// <summary>
/// Gets the height of the preview image, in pixels,
/// or <see langword="null"/> if the height is unknown.
/// </summary>
public int? PreviewHeight { internal set; get; }
/// <summary>
/// Gets the width of the preview image, in pixels,
/// or <see langword="null"/> if the width is unknown.
/// </summary>
public int? PreviewWidth { internal set; get; }
/// <summary>
/// Gets URL of original file.
/// </summary>
public string Source { internal set; get; }
/// <inheritdoc/>
public override string ToString()
{
return this.ID.ToString();
}
}
}