2020-05-01 19:05:28 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2022-11-27 12:29:35 +00:00
|
|
|
using System.Net;
|
2020-05-02 18:57:31 +01:00
|
|
|
using System.Net.Http;
|
2022-11-18 11:30:09 +00:00
|
|
|
using System.Threading;
|
2022-11-27 12:29:35 +00:00
|
|
|
using System.Threading.Tasks;
|
2020-05-01 19:05:28 +01:00
|
|
|
|
|
|
|
namespace SpotifyAPI.Web.Http
|
|
|
|
{
|
|
|
|
public interface IAPIConnector
|
|
|
|
{
|
|
|
|
// IAuthenticator Authenticator { get; }
|
|
|
|
|
|
|
|
// IJSONSerializer JSONSerializer { get; }
|
|
|
|
|
|
|
|
// IHTTPClient HTTPClient { get; }
|
|
|
|
|
2020-05-30 22:20:42 +01:00
|
|
|
event EventHandler<IResponse>? ResponseReceived;
|
|
|
|
|
2020-05-05 14:30:00 +01:00
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
2022-11-18 11:30:09 +00:00
|
|
|
Task<T> Get<T>(Uri uri, CancellationToken cancel = default);
|
2020-05-05 14:30:00 +01:00
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
2022-11-18 11:30:09 +00:00
|
|
|
Task<T> Get<T>(Uri uri, IDictionary<string, string>? parameters, CancellationToken cancel = default);
|
2020-05-07 17:03:20 +01:00
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
2022-11-18 11:30:09 +00:00
|
|
|
Task<HttpStatusCode> Get(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
2020-05-01 19:05:28 +01:00
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
Task<T> Post<T>(Uri uri, CancellationToken cancel = default);
|
|
|
|
Task<T> Post<T>(Uri uri, IDictionary<string, string>? parameters, CancellationToken cancel = default);
|
|
|
|
Task<T> Post<T>(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
|
|
|
Task<T> Post<T>(Uri uri, IDictionary<string, string>? parameters, object? body, Dictionary<string, string>? headers, CancellationToken cancel = default);
|
|
|
|
Task<HttpStatusCode> Post(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
2020-05-01 19:05:28 +01:00
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
Task<T> Put<T>(Uri uri, CancellationToken cancel = default);
|
|
|
|
Task<T> Put<T>(Uri uri, IDictionary<string, string>? parameters, CancellationToken cancel = default);
|
|
|
|
Task<T> Put<T>(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
|
|
|
Task<HttpStatusCode> Put(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
|
|
|
Task<HttpStatusCode> PutRaw(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
2020-05-01 19:05:28 +01:00
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
Task<T> Delete<T>(Uri uri, CancellationToken cancel = default);
|
|
|
|
Task<T> Delete<T>(Uri uri, IDictionary<string, string>? parameters, CancellationToken cancel = default);
|
|
|
|
Task<T> Delete<T>(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
|
|
|
Task<HttpStatusCode> Delete(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
|
2020-05-01 19:05:28 +01:00
|
|
|
|
2020-05-13 22:49:54 +01:00
|
|
|
Task<T> SendAPIRequest<T>(
|
|
|
|
Uri uri, HttpMethod method,
|
2020-05-25 17:00:38 +01:00
|
|
|
IDictionary<string, string>? parameters = null,
|
|
|
|
object? body = null,
|
2022-11-18 11:30:09 +00:00
|
|
|
IDictionary<string, string>? headers = null,
|
|
|
|
CancellationToken cancel = default);
|
2020-05-02 18:57:31 +01:00
|
|
|
|
2020-05-01 19:05:28 +01:00
|
|
|
void SetRequestTimeout(TimeSpan timeout);
|
|
|
|
}
|
|
|
|
}
|