|
1 | 1 | using Microsoft.AspNetCore.Mvc; |
2 | 2 | using RandomAPI.Models; |
3 | | -using RandomAPI.Services.Webhooks; |
4 | | - |
5 | | -public interface IWebhookService |
| 3 | +namespace RandomAPI.Services.Webhooks |
6 | 4 | { |
7 | | - // Basel class methods |
8 | | - /// <summary> |
9 | | - /// Sends a webhook notification to all registered listeners. |
10 | | - /// </summary> |
11 | | - Task BroadcastAsync<T>(T payload) where T : class; |
| 5 | + public interface IWebhookService |
| 6 | + { |
| 7 | + // Basel class methods |
| 8 | + /// <summary> |
| 9 | + /// Sends a webhook notification to all registered listeners. |
| 10 | + /// </summary> |
| 11 | + Task BroadcastAsync<T>(T payload) where T : class; |
12 | 12 |
|
13 | | - /// <summary> |
14 | | - /// Registers a new webhook listener URL. |
15 | | - /// </summary> |
16 | | - /// <returns>True if added, false if it already existed.</returns> |
17 | | - Task AddListenerAsync(string url, WebhookType type = default); |
| 13 | + /// <summary> |
| 14 | + /// Registers a new webhook listener URL. |
| 15 | + /// </summary> |
| 16 | + /// <returns>True if added, false if it already existed.</returns> |
| 17 | + Task AddListenerAsync(string url, WebhookType type = default); |
18 | 18 |
|
19 | | - /// <summary> |
20 | | - /// Removes a webhook listener URL. |
21 | | - /// </summary> |
22 | | - /// <returns>True if removed, false if not found.</returns> |
23 | | - Task<bool> RemoveListenerAsync(string url); |
| 19 | + /// <summary> |
| 20 | + /// Removes a webhook listener URL. |
| 21 | + /// </summary> |
| 22 | + /// <returns>True if removed, false if not found.</returns> |
| 23 | + Task<bool> RemoveListenerAsync(string url); |
24 | 24 |
|
25 | | - /// <summary> |
26 | | - /// Returns a snapshot of all registered listener URLs. |
27 | | - /// </summary> |
28 | | - Task<IEnumerable<string>> GetListenersAsync(); |
| 25 | + /// <summary> |
| 26 | + /// Returns a snapshot of all registered listener URLs. |
| 27 | + /// </summary> |
| 28 | + Task<IEnumerable<string>> GetListenersAsync(); |
29 | 29 |
|
30 | | - /// <summary> |
31 | | - /// returns a snapshot of all registered listenrs of a given type |
32 | | - /// </summary> |
33 | | - /// <param name="type"> the type of url</param> |
34 | | - Task<IEnumerable<string>> GetListenersAsync(WebhookType type = WebhookType.Default); |
| 30 | + /// <summary> |
| 31 | + /// returns a snapshot of all registered listenrs of a given type |
| 32 | + /// </summary> |
| 33 | + /// <param name="type"> the type of url</param> |
| 34 | + Task<IEnumerable<string>> GetListenersAsync(WebhookType type = WebhookType.Default); |
35 | 35 |
|
36 | | - // Controller Logic Methods (Implemented in the derived class) |
37 | | - public Task<IActionResult> HandleGetListenersActionAsync(); |
38 | | - public Task<IActionResult> HandleGetListenersOfTypeAsync(WebhookType type); |
39 | | - public Task<IActionResult> HandleRegisterActionAsync(string url, WebhookType type = default); |
40 | | - public Task<IActionResult> HandleUnregisterActionAsync(string url); |
41 | | - public Task<IActionResult> HandleBroadcastActionAsync(IWebHookPayload payload); |
| 36 | + // Controller Logic Methods (Implemented in the derived class) |
| 37 | + public Task<IActionResult> HandleGetListenersActionAsync(); |
| 38 | + public Task<IActionResult> HandleGetListenersOfTypeAsync(WebhookType type); |
| 39 | + public Task<IActionResult> HandleRegisterActionAsync(string url, WebhookType type = default); |
| 40 | + public Task<IActionResult> HandleUnregisterActionAsync(string url); |
| 41 | + public Task<IActionResult> HandleBroadcastActionAsync(IWebHookPayload payload); |
42 | 42 |
|
43 | | - public enum WebhookType |
44 | | - { |
45 | | - Default = 0, |
46 | | - Discord = 1, |
47 | | - Logging = 2, |
| 43 | + public enum WebhookType |
| 44 | + { |
| 45 | + Default = 0, |
| 46 | + Discord = 1, |
| 47 | + Logging = 2, |
| 48 | + } |
48 | 49 | } |
49 | 50 | } |
| 51 | + |
0 commit comments