Spotify.NET/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs

54 lines
2.8 KiB
C#
Raw Normal View History

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;
using System.Net.Http;
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; }
event EventHandler<IResponse>? ResponseReceived;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
Task<T> Get<T>(Uri uri, CancellationToken cancel = default);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
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")]
Task<HttpStatusCode> Get(Uri uri, IDictionary<string, string>? parameters, object? body, CancellationToken cancel = default);
2020-05-01 19:05:28 +01: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
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
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
Task<T> SendAPIRequest<T>(
Uri uri, HttpMethod method,
2020-05-25 17:00:38 +01:00
IDictionary<string, string>? parameters = null,
object? body = null,
IDictionary<string, string>? headers = null,
CancellationToken cancel = default);
2020-05-01 19:05:28 +01:00
void SetRequestTimeout(TimeSpan timeout);
}
}