-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomEmojiController.cs
47 lines (41 loc) · 1.45 KB
/
CustomEmojiController.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
namespace CustomEmoji.Source.Controller
{
using System.Collections.Generic;
using CustomEmoji.Source.CustomEmojiInterface;
using CustomEmoji.Source.Provider;
using Microsoft.AspNetCore.Mvc;
public class CustomEmojiController
{
private ICustomEmojiProvider provider = new CustomEmojiProvider();
[HttpGet]
[Route("customEmoji/publicEmojis")]
public IList<CustomEmojiEntry> GetPublicCustomEmojis()
{
return this.provider.GetPublicCustomEmojiEntries();
}
[HttpGet]
[Route("{userId}/customEmoji/userEmojis")]
public IList<CustomEmojiEntry> GetCustomEmojisByUserId([FromRoute] string userId)
{
return this.provider.GetCustomEmojiEntriesByUserId(userId);
}
[HttpPost]
[Route("customEmoji/emoji")]
public void CreateCustomEmoji([FromBody] CustomEmojiEntry emoji)
{
this.provider.TryAddCustomEmojiEntry(emoji);
}
[HttpPut]
[Route("customEmoji/emoji")]
public void UpdateCustomEmoji([FromBody] CustomEmojiEntry emoji)
{
this.provider.TryAddOrUpdateCustomEmojiEntry(emoji);
}
[HttpDelete]
[Route("{userId}/customEmoji/{emojiId}")]
public void DeleteAppEntitlement([FromRoute] string userId, [FromRoute] string emojiId)
{
this.provider.TryInactiveExistingCustomEmojiEntry(emojiId, userId);
}
}
}