-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathINetworkRequest.cs
More file actions
59 lines (53 loc) · 1.85 KB
/
INetworkRequest.cs
File metadata and controls
59 lines (53 loc) · 1.85 KB
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
51
52
53
54
55
56
57
58
59
// MADE Apps licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace MADE.Networking.Http.Requests
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Defines an interface for a basic network request.
/// </summary>
public interface INetworkRequest
{
/// <summary>
/// Gets the identifier for the request.
/// </summary>
Guid Identifier { get; }
/// <summary>
/// Gets or sets the URL for the request.
/// </summary>
string Url { get; set; }
/// <summary>
/// Gets the headers for the request.
/// </summary>
Dictionary<string, string> Headers { get; }
/// <summary>
/// Executes the network request.
/// </summary>
/// <typeparam name="TResponse">
/// The type of object returned from the request.
/// </typeparam>
/// <param name="cancellationToken">
/// The cancellation token.
/// </param>
/// <returns>
/// Returns the response of the request as the specified type.
/// </returns>
Task<TResponse> ExecuteAsync<TResponse>(CancellationToken cancellationToken = default);
/// <summary>
/// Executes the network request.
/// </summary>
/// <param name="expectedResponse">
/// The type expected by the response of the request.
/// </param>
/// <param name="cancellationToken">
/// The cancellation token.
/// </param>
/// <returns>
/// Returns the response of the request as an object.
/// </returns>
Task<object> ExecuteAsync(Type expectedResponse, CancellationToken cancellationToken = default);
}
}