Added IAttachment and several missing properties.

This commit is contained in:
RogueException
2016-07-07 11:30:36 -03:00
parent 7723130713
commit 2dea7ff7a9
6 changed files with 36 additions and 8 deletions

View File

@@ -9,8 +9,8 @@ namespace Discord.API
[JsonProperty("proxy_url")] [JsonProperty("proxy_url")]
public string ProxyUrl { get; set; } public string ProxyUrl { get; set; }
[JsonProperty("height")] [JsonProperty("height")]
public int Height { get; set; } public Optional<int> Height { get; set; }
[JsonProperty("width")] [JsonProperty("width")]
public int Width { get; set; } public Optional<int> Width { get; set; }
} }
} }

View File

@@ -2,17 +2,25 @@
namespace Discord namespace Discord
{ {
public struct Attachment internal class Attachment : IAttachment
{ {
public ulong Id { get; } public ulong Id { get; }
public int Size { get; }
public string Filename { get; } public string Filename { get; }
public string Url { get; }
public string ProxyUrl { get; }
public int Size { get; }
public int? Height { get; }
public int? Width { get; }
public Attachment(Model model) public Attachment(Model model)
{ {
Id = model.Id; Id = model.Id;
Size = model.Size;
Filename = model.Filename; Filename = model.Filename;
Size = model.Size;
Url = model.Url;
ProxyUrl = model.ProxyUrl;
Height = model.Height.IsSpecified ? model.Height.Value : (int?)null;
Width = model.Width.IsSpecified ? model.Width.Value : (int?)null;
} }
} }
} }

View File

@@ -18,6 +18,12 @@ namespace Discord
} }
internal EmbedThumbnail(Model model) internal EmbedThumbnail(Model model)
: this(model.Url, model.ProxyUrl, model.Height, model.Width) { } : this(
model.Url,
model.ProxyUrl,
model.Height.IsSpecified ? model.Height.Value : (int?)null,
model.Width.IsSpecified ? model.Width.Value : (int?)null)
{
}
} }
} }

View File

@@ -0,0 +1,14 @@
namespace Discord
{
public interface IAttachment
{
ulong Id { get; }
string Filename { get; }
string Url { get; }
string ProxyUrl { get; }
int Size { get; }
int? Height { get; }
int? Width { get; }
}
}

View File

@@ -25,7 +25,7 @@ namespace Discord
/// <summary> Gets the author of this message. </summary> /// <summary> Gets the author of this message. </summary>
IUser Author { get; } IUser Author { get; }
/// <summary> Returns a collection of all attachments included in this message. </summary> /// <summary> Returns a collection of all attachments included in this message. </summary>
IReadOnlyCollection<Attachment> Attachments { get; } IReadOnlyCollection<IAttachment> Attachments { get; }
/// <summary> Returns a collection of all embeds included in this message. </summary> /// <summary> Returns a collection of all embeds included in this message. </summary>
IReadOnlyCollection<IEmbed> Embeds { get; } IReadOnlyCollection<IEmbed> Embeds { get; }
/// <summary> Returns a collection of channel ids mentioned in this message. </summary> /// <summary> Returns a collection of channel ids mentioned in this message. </summary>

View File

@@ -23,7 +23,7 @@ namespace Discord
public IMessageChannel Channel { get; } public IMessageChannel Channel { get; }
public IUser Author { get; } public IUser Author { get; }
public IReadOnlyCollection<Attachment> Attachments { get; private set; } public IReadOnlyCollection<IAttachment> Attachments { get; private set; }
public IReadOnlyCollection<IEmbed> Embeds { get; private set; } public IReadOnlyCollection<IEmbed> Embeds { get; private set; }
public IReadOnlyCollection<ulong> MentionedChannelIds { get; private set; } public IReadOnlyCollection<ulong> MentionedChannelIds { get; private set; }
public IReadOnlyCollection<IRole> MentionedRoles { get; private set; } public IReadOnlyCollection<IRole> MentionedRoles { get; private set; }