/
FacebookAttachmentImage.cs
55 lines (40 loc) · 1.48 KB
/
FacebookAttachmentImage.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
using Newtonsoft.Json.Linq;
using Skybrud.Essentials.Json.Extensions;
namespace Skybrud.Social.Facebook.Models.Attachments {
/// <summary>
/// Class representing an image of a Facebook attachment.
/// </summary>
public class FacebookAttachmentImage : FacebookObject {
#region Properties
/// <summary>
/// Gets the height of the image.
/// </summary>
public int Height { get; }
/// <summary>
/// Gets the source URL of the image.
/// </summary>
public string Src { get; }
/// <summary>
/// Gets the width of the image.
/// </summary>
public int Width { get; }
#endregion
#region Constructors
private FacebookAttachmentImage(JObject obj) : base(obj) {
Height = obj.GetInt32("height");
Src = obj.GetString("src");
Width = obj.GetInt32("width");
}
#endregion
#region Static methods
/// <summary>
/// Parses the specified <paramref name="obj"/> into an instance of <see cref="FacebookAttachmentImage"/>.
/// </summary>
/// <param name="obj">The instance of <see cref="JObject"/> to be parsed.</param>
/// <returns>An instance of <see cref="FacebookAttachmentImage"/>.</returns>
public static FacebookAttachmentImage Parse(JObject obj) {
return obj == null ? null : new FacebookAttachmentImage(obj);
}
#endregion
}
}