Exemple #1
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "emoji")] HttpRequest req,
            ILogger log)
        {
            var emojiList = await EmojiTable.GetAllEmojis();

            var groupedEmojis =
                emojiList.GroupBy(e => e.Group)
                .Select(g => new
            {
                Group     = g.Key,
                SubGroups = g.GroupBy(e => e.SubGroup)
                            .Select(sg => new {
                    SubGroup = sg.Key,
                    Emojis   = sg.Select(e => new {
                        Emoji    = e.Emoji,
                        Cldr     = e.Cldr,
                        Codes    = e.Code.Split('_'),
                        Keywords = e.Keywords,
                    })
                })
            });

            var serializerSettings = new JsonSerializerSettings();

            serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            return(new JsonResult(groupedEmojis, serializerSettings));
        }
Exemple #2
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "emoji/palettes")] HttpRequest req,
            ILogger log)
        {
            var emojiList = await EmojiTable.GetAllEmojis();

            var groupedEmojis =
                emojiList.GroupBy(e => e.Group)
                .Select(g => new
            {
                Group = g.Key,
                Emoji = g.Select(e => e.Emoji)
            });

            var serializerSettings = new JsonSerializerSettings();

            serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            return(new JsonResult(groupedEmojis, serializerSettings));
        }