add support for parameter building on ApiClient

This commit is contained in:
2024-12-07 08:21:50 +01:00
parent d333710a8f
commit 917e9edd80
2 changed files with 81 additions and 56 deletions

View File

@@ -12,23 +12,67 @@ public interface IApiClient
ILogger Log { get; set; }
Task<ApiResponse> SendRequest(string route);
Task<ApiResponse> SendRequest(string route, HttpMethod method, ApiMessage? message, IDictionary<string, object>? @params, IApiMessageSerializer? serializer);
Task<ApiResponse> SendRequest(string route, HttpMethod method);
Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method, ApiMessage? message, IDictionary<string, object>? @params, IApiMessageSerializer? serializer) where TResponse : ApiMessage;
Task<ApiResponse> SendRequest(string route, ApiMessage? message);
public virtual Task<ApiResponse> SendRequest(string route)
{
return SendRequest(route, HttpMethod.Post, null, null, null);
}
Task<ApiResponse> SendRequest(string route, HttpMethod method, ApiMessage? message);
public virtual Task<ApiResponse> SendRequest(string route, HttpMethod method)
{
return SendRequest(route, method, null, null, null);
}
Task<ApiResponse> SendRequest(string route, HttpMethod method, ApiMessage? message, IApiMessageSerializer? serializer);
public virtual Task<ApiResponse> SendRequest(string route, HttpMethod method, IDictionary<string, object>? @params)
{
return SendRequest(route, method, null, @params, null);
}
Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route) where TResponse : ApiMessage;
public virtual Task<ApiResponse> SendRequest(string route, ApiMessage? message)
{
return SendRequest(route, HttpMethod.Post, message, null, null);
}
Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method) where TResponse : ApiMessage;
public virtual Task<ApiResponse> SendRequest(string route, HttpMethod method, ApiMessage? message)
{
return SendRequest(route, method, message, null, null);
}
Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, ApiMessage? message) where TResponse : ApiMessage;
public virtual Task<ApiResponse> SendRequest(string route, HttpMethod method, ApiMessage? message, IDictionary<string, object>? @params)
{
return SendRequest(route, method, message, @params, null);
}
Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method, ApiMessage? message) where TResponse : ApiMessage;
public virtual Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route) where TResponse : ApiMessage
{
return SendRequest<TResponse>(route, HttpMethod.Post, null, null, null);
}
Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method, ApiMessage? message, IApiMessageSerializer? serializer) where TResponse : ApiMessage;
public virtual Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method) where TResponse : ApiMessage
{
return SendRequest<TResponse>(route, method, null, null, null);
}
public virtual Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method, IDictionary<string, object>? @params) where TResponse : ApiMessage
{
return SendRequest<TResponse>(route, method, null, @params, null);
}
public virtual Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, ApiMessage? message) where TResponse : ApiMessage
{
return SendRequest<TResponse>(route, HttpMethod.Post, message, null, null);
}
public virtual Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method, ApiMessage? message) where TResponse : ApiMessage
{
return SendRequest<TResponse>(route, method, message, null, null);
}
public virtual Task<ApiResponse<TResponse>> SendRequest<TResponse>(string route, HttpMethod method, ApiMessage? message, IDictionary<string, object>? @params) where TResponse : ApiMessage
{
return SendRequest<TResponse>(route, method, message, @params, null);
}
}