-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRestClientJsonRequest.cs
More file actions
42 lines (36 loc) · 1.99 KB
/
RestClientJsonRequest.cs
File metadata and controls
42 lines (36 loc) · 1.99 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
using Crestron.SimplSharp;
using System.Diagnostics;
namespace RestSharp
{
public static class RestClientJsonRequest
{
public static IRestResponse<TResponse> Get<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.GET)); }
public static IRestResponse<TResponse> Post<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.POST)); }
public static IRestResponse<TResponse> Put<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.PUT)); }
public static IRestResponse<TResponse> Head<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.HEAD)); }
public static IRestResponse<TResponse> Options<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.OPTIONS)); }
public static IRestResponse<TResponse> Patch<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.PATCH)); }
public static IRestResponse<TResponse> Delete<TRequest, TResponse>(
this IRestClient client, JsonRequest<TRequest, TResponse> request
) where TResponse : new()
{ return request.UpdateResponse(client.Execute<TResponse>(request, Method.DELETE)); }
}
}