public async Task HandleAsync(WebhookPayloadContext context) { await mediator.Send( new DeleteInstanceByPullRequestCommand( context.Repository.Handle, context.PullRequest.Handle)); }
public async Task HandleAsync(WebhookPayloadContext context) { var payload = context.Payload; var text = ExtractCommentTextFromPayload(payload); switch (text) { case "@pull-dog down": await this.mediator.Send(new DeleteInstanceByPullRequestCommand( context.Repository.Handle, context.PullRequest.Handle)); break; case "@pull-dog up": await this.mediator.Send(new ProvisionPullDogEnvironmentCommand( context.PullRequest.Handle, context.Repository)); break; case null: throw new InvalidOperationException("No text found."); } }