FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
InvvardDev.IFTTT.NET/src/Controllers/TriggerController.cs at develop · Invvard/InvvardDev.IFTTT.NET · GitHub
Invvard
InvvardDev.IFTTT.NET
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
InvvardDev.IFTTT.NET
/
src
/
Controllers
/
TriggerController.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (28 loc) · 1.14 KB
Breadcrumbs
InvvardDev.IFTTT.NET
/
src
/
Controllers
/
TriggerController.cs
Copy path
File metadata and controls
32 lines (28 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using
InvvardDev
.
Ifttt
.
Contracts
;
using
InvvardDev
.
Ifttt
.
Hosting
;
using
InvvardDev
.
Ifttt
.
Models
.
Core
;
using
InvvardDev
.
Ifttt
.
Toolkit
;
using
Microsoft
.
AspNetCore
.
Mvc
;
namespace
InvvardDev
.
Ifttt
.
Controllers
;
[
ApiController
,
Route
(
IftttConstants
.
BaseTriggersApiPath
)
]
public
class
TriggerController
(
[
FromKeyedServices
(
ProcessorKind
.
Trigger
)
]
IProcessorService
triggerService
)
:
ControllerBase
{
/// <summary>
/// Execute a trigger
/// </summary>
/// <param name="triggerSlug">The trigger slug that is executed.</param>
/// <param name="triggerRequest">The request parameters.</param>
[
HttpPost
(
"{triggerSlug}"
)
]
[
ProducesResponseType
(
StatusCodes
.
Status200OK
)
,
ProducesResponseType
(
StatusCodes
.
Status404NotFound
)
]
[
Consumes
(
"application/json"
)
,
Produces
(
"application/json"
)
]
public
async
Task
<
IActionResult
>
ExecuteTrigger
(
string
triggerSlug
,
TriggerRequest
triggerRequest
)
{
if
(
await
triggerService
.
GetProcessorInstance
<
ITrigger
>
(
triggerSlug
)
is
not
{
}
trigger
)
{
return
NotFound
(
)
;
}
var
result
=
await
trigger
.
ExecuteAsync
(
triggerRequest
)
;
return
Ok
(
result
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL