forked from soxtoby/SlackNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SlackEndpoints.cs
35 lines (28 loc) · 1.39 KB
/
SlackEndpoints.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
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using SlackNet.AspNetCore;
namespace AzureFunctionExample;
public class SlackEndpoints
{
private readonly ISlackRequestHandler _requestHandler;
private readonly SlackEndpointConfiguration _endpointConfig;
public SlackEndpoints(ISlackRequestHandler requestHandler, SlackEndpointConfiguration endpointConfig)
{
_requestHandler = requestHandler;
_endpointConfig = endpointConfig;
}
[FunctionName("event")]
public Task<SlackResult> Event([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest request) =>
_requestHandler.HandleEventRequest(request, _endpointConfig);
[FunctionName("action")]
public Task<SlackResult> Action([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest request) =>
_requestHandler.HandleActionRequest(request, _endpointConfig);
[FunctionName("options")]
public Task<SlackResult> Options([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest request) =>
_requestHandler.HandleOptionsRequest(request, _endpointConfig);
[FunctionName("command")]
public Task<SlackResult> Command([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest request) =>
_requestHandler.HandleSlashCommandRequest(request, _endpointConfig);
}