-
-
Notifications
You must be signed in to change notification settings - Fork 109
/
IRequester.cs
50 lines (45 loc) · 2.32 KB
/
IRequester.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
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Net.Http;
using System.Threading.Tasks;
using System;
using System.IO;
namespace RestEase
{
/// <summary>
/// Called by the generated REST API implementation, this knows how to invoke the API and return a suitable response
/// </summary>
public interface IRequester : IDisposable
{
/// <summary>
/// Invoked when the API interface method being called returns a Task
/// </summary>
/// <param name="requestInfo">Object holding all information about the request</param>
/// <returns>Task to return to the API interface caller</returns>
Task RequestVoidAsync(IRequestInfo requestInfo);
/// <summary>
/// Invoked when the API interface method being called returns a Task{T}
/// </summary>
/// <typeparam name="T">Type of response object expected by the caller</typeparam>
/// <param name="requestInfo">Object holding all information about the request</param>
/// <returns>Task to return to the API interface caller</returns>
Task<T> RequestAsync<T>(IRequestInfo requestInfo);
/// <summary>
/// Invoked when the API interface method being called returns a Task{HttpResponseMessage}
/// </summary>
/// <param name="requestInfo">Object holding all information about the request</param>
/// <returns>Task to return to the API interface caller</returns>
Task<HttpResponseMessage> RequestWithResponseMessageAsync(IRequestInfo requestInfo);
/// <summary>
/// Invoked when the API interface method being called returns a Task{Response{T}}
/// </summary>
/// <typeparam name="T">Type of response object expected by the caller</typeparam>
/// <param name="requestInfo">Object holding all information about the request</param>
/// <returns>Task to return to the API interface caller</returns>
Task<Response<T>> RequestWithResponseAsync<T>(IRequestInfo requestInfo);
/// <summary>
/// Invoked when the API interface method being called returns a Task{Stream}
/// </summary>
/// <param name="requestInfo">Object holding all information about the request</param>
/// <returns>Task to return to the API interface caller</returns>
Task<Stream?> RequestStreamAsync(IRequestInfo requestInfo);
}
}