Skip to content

Commit

Permalink
Merge pull request #29 from alexdillon/develop
Browse files Browse the repository at this point in the history
Merge version 1.1.1
  • Loading branch information
alexdillon authored Aug 24, 2021
2 parents fd924e3 + 3857c20 commit 110cd7c
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 9 deletions.
6 changes: 3 additions & 3 deletions GroupMeClientApi/GroupMeClientApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="JsonSubTypes" Version="1.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RestSharp" Version="106.11.4" />
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="RestSharp" Version="106.12.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
8 changes: 8 additions & 0 deletions GroupMeClientApi/Models/Attachments/Attachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ namespace GroupMeClientApi.Models.Attachments
[JsonSubtypes.KnownSubType(typeof(ReplyAttachment), "reply")]
public class Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="Attachment"/> class.
/// </summary>
internal Attachment()
{
}

/// <summary>
/// Gets the attachment type.
/// </summary>
[JsonProperty("type")]
public virtual string Type { get; }
}
}
7 changes: 7 additions & 0 deletions GroupMeClientApi/Models/Attachments/EmojiAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class EmojiAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="EmojiAttachment"/> class.
/// </summary>
internal EmojiAttachment()
{
}

/// <inheritdoc/>
public override string Type { get; } = "emoji";

Expand Down
8 changes: 7 additions & 1 deletion GroupMeClientApi/Models/Attachments/FileAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class FileAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="FileAttachment"/> class.
/// </summary>
internal FileAttachment()
{
}

/// <summary>
/// Gets the default buffer size, in bytes, used for uploading content.
/// </summary>
public static int DefaultUploadBlockSize => ProgressableBlockContent.DefaultBufferSize;

/// <inheritdoc/>
[JsonProperty("type")]
public override string Type { get; } = "file";

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion GroupMeClientApi/Models/Attachments/ImageAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class ImageAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="ImageAttachment"/> class.
/// </summary>
internal ImageAttachment()
{
}

/// <summary>
/// Gets the default buffer size, in bytes, used for uploading content.
/// </summary>
Expand All @@ -22,7 +29,6 @@ public class ImageAttachment : Attachment
public static IEnumerable<string> SupportedExtensions { get; } = new List<string>() { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };

/// <inheritdoc/>
[JsonProperty("type")]
public override string Type { get; } = "image";

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion GroupMeClientApi/Models/Attachments/LinkedImageAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class LinkedImageAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="LinkedImageAttachment"/> class.
/// </summary>
internal LinkedImageAttachment()
{
}

/// <inheritdoc/>
[JsonProperty("type")]
public override string Type { get; } = "linked_image";

/// <summary>
Expand Down
7 changes: 7 additions & 0 deletions GroupMeClientApi/Models/Attachments/LocationAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class LocationAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="LocationAttachment"/> class.
/// </summary>
internal LocationAttachment()
{
}

/// <inheritdoc/>
public override string Type { get; } = "location";

Expand Down
7 changes: 7 additions & 0 deletions GroupMeClientApi/Models/Attachments/MentionsAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class MentionsAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="MentionsAttachment"/> class.
/// </summary>
internal MentionsAttachment()
{
}

/// <inheritdoc/>
public override string Type { get; } = "mentions";

Expand Down
22 changes: 22 additions & 0 deletions GroupMeClientApi/Models/Attachments/ReplyAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class ReplyAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="ReplyAttachment"/> class.
/// </summary>
internal ReplyAttachment()
{
}

/// <inheritdoc/>
public override string Type { get; } = "reply";

Expand All @@ -27,5 +34,20 @@ public class ReplyAttachment : Attachment
/// </summary>
[JsonProperty("base_reply_id")]
public string BaseRepliedMessageId { get; internal set; }

/// <summary>
/// Creates a new attachment indicating that a message is being sent in reply to an
/// existing message.
/// </summary>
/// <param name="replyToMessage">The existing message that is being replied to.</param>
/// <returns>A new reply attachment.</returns>
public static ReplyAttachment CreateReplyAttachment(Message replyToMessage)
{
return new ReplyAttachment()
{
BaseRepliedMessageId = replyToMessage.Id,
RepliedMessageId = replyToMessage.Id,
};
}
}
}
7 changes: 7 additions & 0 deletions GroupMeClientApi/Models/Attachments/SplitAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class SplitAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="SplitAttachment"/> class.
/// </summary>
internal SplitAttachment()
{
}

/// <inheritdoc/>
public override string Type { get; } = "split";

Expand Down
8 changes: 7 additions & 1 deletion GroupMeClientApi/Models/Attachments/VideoAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ namespace GroupMeClientApi.Models.Attachments
/// </summary>
public class VideoAttachment : Attachment
{
/// <summary>
/// Initializes a new instance of the <see cref="VideoAttachment"/> class.
/// </summary>
internal VideoAttachment()
{
}

/// <inheritdoc/>
[JsonProperty("type")]
public override string Type { get; } = "video";

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion GroupMeClientApi/Models/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using GroupMeClientApi.Models.Attachments;
using Newtonsoft.Json;
using RestSharp;

Expand Down Expand Up @@ -149,7 +150,7 @@ public Message LatestMessage

return new Message()
{
Attachments = this.MsgPreview.Preview.Attachments,
Attachments = new List<Attachment>(this.MsgPreview.Preview.Attachments),
Text = this.MsgPreview.Preview.Text,
Name = this.MsgPreview.Preview.Nickname,
CreatedAtUnixTime = this.MsgPreview.LastMessageCreatedAtUnixTime,
Expand Down
2 changes: 1 addition & 1 deletion GroupMeClientApi/Models/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public Message()
/// Gets a list of <see cref="Attachments"/> attached to this <see cref="Message"/>.
/// </summary>
[JsonProperty("attachments")]
public ICollection<Attachments.Attachment> Attachments { get; internal set; }
public List<Attachments.Attachment> Attachments { get; internal set; }

/// <summary>
/// Gets the <see cref="Chat"/> this message belongs to.
Expand Down

0 comments on commit 110cd7c

Please sign in to comment.