diff --git a/src/Reddit.NET/Inputs/Emoji/EmojiAddInput.cs b/src/Reddit.NET/Inputs/Emoji/EmojiAddInput.cs
index 920a1a4f..9b4c7ba8 100644
--- a/src/Reddit.NET/Inputs/Emoji/EmojiAddInput.cs
+++ b/src/Reddit.NET/Inputs/Emoji/EmojiAddInput.cs
@@ -15,15 +15,27 @@ public class EmojiAddInput
///
public string s3_key { get; set; }
+ public bool mod_flair_only { get; set; }
+
+ public bool post_flair_allowed { get; set; }
+
+ public bool user_flair_allowed { get; set; }
+
///
/// Data for emoji to be uploaded.
///
/// Name of the emoji to be created. It can be alphanumeric without any special characters except '-' & '_' and cannot exceed 24 characters
/// S3 key of the uploaded image which can be obtained from the S3 url. This is of the form subreddit/hash_value
- public EmojiAddInput(string name, string s3Key)
+ /// If this emoji is exclusive to mods' flairs (or mod-assigned flairs).
+ /// If this emoji should be usable on post flairs.
+ /// If this emoji should be usable on user flairs.
+ public EmojiAddInput(string name, string s3Key, bool modFlairOnly, bool postFlairAllowed, bool userFlairAllowed)
{
this.name = name;
s3_key = s3Key;
+ mod_flair_only = modFlairOnly;
+ post_flair_allowed = postFlairAllowed;
+ user_flair_allowed = userFlairAllowed;
}
}
}
diff --git a/src/Reddit.NET/Inputs/ImageUploadInput.cs b/src/Reddit.NET/Inputs/Emoji/ImageUploadInput.cs
similarity index 77%
rename from src/Reddit.NET/Inputs/ImageUploadInput.cs
rename to src/Reddit.NET/Inputs/Emoji/ImageUploadInput.cs
index efbbdd63..be68889a 100644
--- a/src/Reddit.NET/Inputs/ImageUploadInput.cs
+++ b/src/Reddit.NET/Inputs/Emoji/ImageUploadInput.cs
@@ -1,6 +1,6 @@
using System;
-namespace Reddit.Inputs
+namespace Reddit.Inputs.Emoji
{
[Serializable]
public class ImageUploadInput
@@ -18,11 +18,11 @@ public class ImageUploadInput
///
/// Data for image to be uploaded.
///
- /// name and extension of the image file e.g. image1.png
+ /// name and extension of the image file e.g. image1.png
/// mime type of the image e.g. image/png
- public ImageUploadInput(string filePath, string mimeType)
+ public ImageUploadInput(string fileName, string mimeType)
{
- filepath = filePath;
+ filepath = fileName;
mimetype = mimeType;
}
}
diff --git a/src/Reddit.NET/Models/Emoji.cs b/src/Reddit.NET/Models/Emoji.cs
index 89a995dc..f0770bcb 100644
--- a/src/Reddit.NET/Models/Emoji.cs
+++ b/src/Reddit.NET/Models/Emoji.cs
@@ -1,15 +1,20 @@
-using Newtonsoft.Json;
-using Reddit.Inputs;
+using System.IO;
+using System.Net;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+using Newtonsoft.Json;
+using RestSharp;
using Reddit.Inputs.Emoji;
using Reddit.Things;
-using RestSharp;
-using System;
-using System.Linq;
+using Reddit.Exceptions;
namespace Reddit.Models
{
public class Emoji : BaseModel
{
+ // Used for deserializing S3PostResponse from S3 emoji post. --MingweiSamuel
+ private static readonly XmlSerializer S3PostResponseXmlSerializer = new XmlSerializer(typeof(S3PostResponse));
+
internal override RestClient RestClient { get; set; }
public Emoji(string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId = null)
@@ -24,11 +29,27 @@ public Emoji(string appId, string appSecret, string refreshToken, string accessT
/// The subreddit with the emojis
/// A valid EmojiAddInput instance
/// (TODO - Untested)
+ // TODO returns {"json": {"errors": []}}
public object Add(string subreddit, EmojiAddInput emojiAddInput)
{
return SendRequest