29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RudderSdk.Core.Abstractions;
|
|
|
|
/// <summary>
|
|
/// HTTP transport used by the SDK for every API call. Implementations serialize
|
|
/// the request as JSON, attach the bearer token, and map non-success HTTP
|
|
/// statuses to <see cref="RudderApiException"/> subclasses
|
|
/// (401 → <see cref="RudderAuthException"/>).
|
|
/// </summary>
|
|
public interface IRudderTransport
|
|
{
|
|
/// <summary>
|
|
/// Sends one API request and deserializes the JSON response.
|
|
/// </summary>
|
|
/// <param name="method">HTTP method (GET, POST, PUT, DELETE).</param>
|
|
/// <param name="path">Absolute path starting at the API root, e.g. /sdk/v1/player/information.</param>
|
|
/// <param name="request">Request body DTO, or null for bodyless requests.</param>
|
|
/// <param name="accessToken">Current access token to send as a Bearer header, or null.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
Task<TResponse> SendAsync<TRequest, TResponse>(
|
|
string method,
|
|
string path,
|
|
TRequest? request,
|
|
string? accessToken,
|
|
CancellationToken cancellationToken = default);
|
|
}
|