< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Execute.GetEndpoint
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Execute/GetEndpoint.cs
Line coverage
100%
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 43
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Configure()100%11100%
HandleAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Execute/GetEndpoint.cs

#LineLine coverage
 1using Elsa.Authorization;
 2using Elsa.Abstractions;
 3using Elsa.Workflows.Api.Security;
 4using Elsa.Workflows.Management;
 5using Elsa.Workflows.Runtime;
 6using JetBrains.Annotations;
 7
 8namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Execute;
 9
 10/// <summary>
 11/// An API endpoint that executes a given workflow definition through GET method.
 12/// </summary>
 13[PublicAPI]
 514internal class GetEndpoint(
 515    IWorkflowDefinitionService workflowDefinitionService,
 516    IWorkflowRuntime workflowRuntime,
 517    IWorkflowStarter workflowStarter,
 518    IApiSerializer apiSerializer,
 519    WorkflowDefinitionScriptAuthorizationService scriptAuthorizationService)
 20    : ElsaEndpoint<GetRequest>
 21{
 22    /// <inheritdoc />
 23    public override void Configure()
 24    {
 325        Routes("/workflow-definitions/{definitionId}/execute");
 326        RequirePermission(Elsa.Workflows.Api.Permissions.WorkflowPermissions.Definitions, CoreVerbs.Execute);
 327        Verbs(FastEndpoints.Http.GET);
 328    }
 29
 30    /// <inheritdoc />
 31    public override async Task HandleAsync(GetRequest request, CancellationToken cancellationToken)
 32    {
 233        await WorkflowExecutionHelper.ExecuteWorkflowAsync(
 234            request,
 235            workflowDefinitionService,
 236            workflowRuntime,
 237            workflowStarter,
 238            apiSerializer,
 239            scriptAuthorizationService,
 240            HttpContext,
 241            cancellationToken);
 242    }
 43}