63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
using RestSharp;
|
|
using System.Net.Http;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using xHttpService.Constants;
|
|
using xIdentityModels.Models;
|
|
using System.Collections.Generic;
|
|
|
|
namespace xHttpService.Interfaces
|
|
{
|
|
public partial interface IXHttpProvider
|
|
{
|
|
/// <summary>
|
|
/// Get an Instance of Http Client
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
HttpClient GetHttpClient();
|
|
|
|
/// <summary>
|
|
/// Retrieve Rest Client ...
|
|
/// </summary>
|
|
/// <param name="baseUrl"></param>
|
|
/// <param name="tokens"></param>
|
|
/// <returns></returns>
|
|
RestClient GetRestClient(
|
|
string baseUrl = null,
|
|
XTokenResponse tokens = null
|
|
);
|
|
|
|
/// <summary>
|
|
/// Prepare and Retrieve a Rest Request ...
|
|
/// </summary>
|
|
/// <param name="endpoint"></param>
|
|
/// <param name="poweredValue"></param>
|
|
/// <param name="params"></param>
|
|
/// <param name="headers"></param>
|
|
/// <param name="queryStrings"></param>
|
|
/// <returns></returns>
|
|
RestRequest GetRestRequet(
|
|
string endpoint,
|
|
string poweredValue = null,
|
|
IDictionary<string, string> @params = null,
|
|
IDictionary<string, string> headers = null,
|
|
IDictionary<string, string> queryStrings = null
|
|
);
|
|
|
|
/// <summary>
|
|
/// Handle Call Specific Request and retrieve Response
|
|
/// </summary>
|
|
/// <param name="client"></param>
|
|
/// <param name="request"></param>
|
|
/// <param name="method"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <returns></returns>
|
|
Task<T> RunRestRequest<T>(
|
|
RestClient client,
|
|
RestRequest request,
|
|
XHttpMethod method,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
}
|
|
} |