-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathGenericRestClient.cs
More file actions
136 lines (132 loc) · 4.27 KB
/
GenericRestClient.cs
File metadata and controls
136 lines (132 loc) · 4.27 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
namespace BytecodeApi.Rest;
/// <summary>
/// Represents a REST client that is not tied to a specific API. This class can be used to perform singular HTTP requests that have no API context.
/// </summary>
public class GenericRestClient : RestClient
{
/// <summary>
/// Represents a singleton <see cref="GenericRestClient" /> instance. Changes to properties of this object are global.
/// </summary>
public static GenericRestClient Instance { get; }
/// <summary>
/// A <see cref="RestRequestOptions" /> object with options for REST requests.
/// </summary>
new public RestRequestOptions RequestOptions
{
get => base.RequestOptions;
set => base.RequestOptions = value;
}
/// <summary>
/// Gets the <see cref="System.Net.Http.HttpClient" /> that is used to process requests.
/// </summary>
new public HttpClient HttpClient => base.HttpClient;
static GenericRestClient()
{
Instance = new();
}
/// <summary>
/// Initializes a new instance of the <see cref="GenericRestClient" /> class.
/// </summary>
public GenericRestClient() : base("")
{
}
/// <summary>
/// Performs a GET request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Get(string url)
{
return base.Get(url);
}
/// <summary>
/// Performs a POST request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Post(string url)
{
return base.Post(url);
}
/// <summary>
/// Performs a PUT request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Put(string url)
{
return base.Put(url);
}
/// <summary>
/// Performs a PATCH request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Patch(string url)
{
return base.Patch(url);
}
/// <summary>
/// Performs a DELETE request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Delete(string url)
{
return base.Delete(url);
}
/// <summary>
/// Performs a PURGE request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Purge(string url)
{
return base.Purge(url);
}
/// <summary>
/// Performs a HEAD request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Head(string url)
{
return base.Head(url);
}
/// <summary>
/// Performs a OPTIONS request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Options(string url)
{
return base.Options(url);
}
/// <summary>
/// Performs a TRACE request on the specified URL.
/// </summary>
/// <param name="url">The URL to perform the request on.</param>
/// <returns>
/// A <see cref="RestRequest" /> object to be used to further refine, and then send the request.
/// </returns>
new public RestRequest Trace(string url)
{
return base.Trace(url);
}
}