-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIResponseHandler.cs
37 lines (34 loc) · 1.3 KB
/
IResponseHandler.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
36
37
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
#if NET461
using System.Net.Http;
#elif NETCOREAPP2_1
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
#endif
namespace Agero.Core.ApiResponse
{
/// <summary>Response handler</summary>
public interface IResponseHandler
{
/// <summary>Handles validation error response</summary>
/// <param name="request">HTTP request message</param>
/// <param name="errors">Validation errors</param>
/// <returns>HTTP response message</returns>
#if NET461
Task<HttpResponseMessage> HandleValidationErrorsAsync(HttpRequestMessage request, IReadOnlyCollection<string> errors);
#elif NETCOREAPP2_1
Task<ObjectResult> HandleValidationErrorsAsync(HttpRequest request, IReadOnlyCollection<string> errors);
#endif
/// <summary>Handles exception response</summary>
/// <param name="request">HTTP request message</param>
/// <param name="exception">Exception</param>
/// <returns>HTTP response message</returns>
#if NET461
Task<HttpResponseMessage> HandleExceptionAsync(HttpRequestMessage request, Exception exception);
#elif NETCOREAPP2_1
Task<ObjectResult> HandleExceptionAsync(HttpRequest request, Exception exception);
#endif
}
}