using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using RestSharp;
using xCommons.Providers;
using xHttpService.Constants;
using xIdentityModels.Constants;
using xIdentityModels.Models;
using xIdentityService.Models;
namespace xIdentityService.Interfaces
{
///
/// an interface for Identity Provided Http Based Services ...
///
public interface IXBaseIdentityHttpProvider
{
///
/// Client Base Url ...
///
///
string BaseUrl { get; }
///
/// Logger ...
///
///
ILogger Logger { get; }
///
/// Powered Value ...
///
///
string XPoweredValue { get; }
///
/// Default Client Timeout ...
///
///
int DefaultClientTimeout { get; }
///
/// Default Buffering Chunk Size ...
///
///
int DefaultBufferingChunckSize { get; }
///
/// Validation Provider ...
///
///
XValidationProvider ValidationProvider { get; }
///
/// Get an Instance of Http Client
///
///
HttpClient GetHttpClient(XTokenResponse tokens = null);
HttpClient GetHttpClient(XUserClaimsInfoDto userInfo = null);
///
/// Get an Instance of RestClient
///
///
RestClient GetRestClient(XTokenResponse tokens = null);
RestClient GetRestClient(XUserClaimsInfoDto userInfo = null);
///
/// Get an Instance of RestRequest
///
///
///
///
///
///
///
RestRequest GetRestRequet(
Enum endpoint,
bool addXPoweredValue = true,
IDictionary @params = null,
IDictionary headers = null,
IDictionary queryStrings = null
);
///
/// Handle Call Specific Request and retrieve Response
///
///
///
///
///
///
///
///
Task RunRestRequest(
RestClient client,
RestRequest request,
XHttpMethod method,
bool supportRefreshingTokens = true,
CancellationToken cancellationToken = default
);
///
/// Access a Get Request Stream as AsyncEnumerable ...
///
///
///
///
///
///
///
///
///
///
IAsyncEnumerable StreamData(
Enum endpoint,
bool addXPoweredValue = true,
XTokenResponse tokens = null,
IDictionary @params = null,
IDictionary headers = null,
IDictionary queryStrings = null,
CancellationToken cancellationToken = default
);
///
/// Handle Call Specified Request and Retrieve XBaseRestResponse ...
///
///
///
///
///
///
///
/// an instance of XBaseRestResponse
Task> RunRestRequestByResponse(
RestClient client,
RestRequest request,
XHttpMethod method,
bool supportRefreshingTokens = true,
CancellationToken cancellationToken = default
);
///
/// Get User SelectBy Param
///
///
///
///
///
string GetUserSelectByParam(
XActionRequest model,
bool forceNotNull = true,
ICollection excludes = null
);
///
/// Converts UserInfo to TokenResponse model ...
///
///
///
XTokenResponse ToTokenResponse(XUserClaimsInfoDto userInfo = null);
///
/// Prepare Url Address of Specified Enum by Filling Params
/// and Query Strings Attach ...
///
///
///
///
///
string PrepareUrl(
Enum endpoint,
IDictionary @params = null,
IDictionary queryStrings = null
);
///
/// Prepare Url Address by Filling Params
/// and Query Strings Attach ...
///
///
///
///
///
string PrepareUrl(
string url,
IDictionary @params = null,
IDictionary queryStrings = null
);
}
}