2015-10-16 23:44:35 +01:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
2015-07-07 17:11:11 +01:00
|
|
|
|
using System.Collections.Generic;
|
2015-11-05 20:20:22 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2016-07-07 20:23:36 +01:00
|
|
|
|
using SpotifyAPI.Web.Models;
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web
|
|
|
|
|
{
|
|
|
|
|
public interface IClient : IDisposable
|
|
|
|
|
{
|
|
|
|
|
JsonSerializerSettings JsonSettings { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Downloads data from an URL and returns it
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Tuple<ResponseInfo, string> Download(string url);
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
2015-11-05 20:20:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Downloads data async from an URL and returns it
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url"></param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Task<Tuple<ResponseInfo, string>> DownloadAsync(string url);
|
2015-11-05 20:20:22 +00:00
|
|
|
|
|
2015-07-07 17:11:11 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Downloads data from an URL and returns it
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Tuple<ResponseInfo, byte[]> DownloadRaw(string url);
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
2015-11-05 20:20:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Downloads data async from an URL and returns it
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url"></param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Task<Tuple<ResponseInfo, byte[]>> DownloadRawAsync(string url);
|
2015-11-05 20:20:22 +00:00
|
|
|
|
|
2015-07-07 17:11:11 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Downloads data from an URL and converts it to an object
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">The Type which the object gets converted to</typeparam>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Tuple<ResponseInfo, T> DownloadJson<T>(string url);
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
2015-11-05 20:20:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Downloads data async from an URL and converts it to an object
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">The Type which the object gets converted to</typeparam>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Task<Tuple<ResponseInfo, T>> DownloadJsonAsync<T>(string url);
|
2015-11-05 20:20:22 +00:00
|
|
|
|
|
2015-07-07 17:11:11 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uploads data from an URL and returns the response
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <param name="body">The Body-Data (most likely a JSON String)</param>
|
|
|
|
|
/// <param name="method">The Upload-method (POST,DELETE,PUT)</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Tuple<ResponseInfo, string> Upload(string url, string body, string method);
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
2015-11-05 20:20:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uploads data async from an URL and returns the response
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <param name="body">The Body-Data (most likely a JSON String)</param>
|
|
|
|
|
/// <param name="method">The Upload-method (POST,DELETE,PUT)</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Task<Tuple<ResponseInfo, string>> UploadAsync(string url, string body, string method);
|
2015-11-05 20:20:22 +00:00
|
|
|
|
|
2015-07-07 17:11:11 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uploads data from an URL and returns the response
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <param name="body">The Body-Data (most likely a JSON String)</param>
|
|
|
|
|
/// <param name="method">The Upload-method (POST,DELETE,PUT)</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Tuple<ResponseInfo, byte[]> UploadRaw(string url, string body, string method);
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
2015-11-05 20:20:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uploads data async from an URL and returns the response
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <param name="body">The Body-Data (most likely a JSON String)</param>
|
|
|
|
|
/// <param name="method">The Upload-method (POST,DELETE,PUT)</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Task<Tuple<ResponseInfo, byte[]>> UploadRawAsync(string url, string body, string method);
|
2015-11-05 20:20:22 +00:00
|
|
|
|
|
2015-07-07 17:11:11 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uploads data from an URL and converts the response to an object
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">The Type which the object gets converted to</typeparam>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <param name="body">The Body-Data (most likely a JSON String)</param>
|
|
|
|
|
/// <param name="method">The Upload-method (POST,DELETE,PUT)</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Tuple<ResponseInfo, T> UploadJson<T>(string url, string body, string method);
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
2015-11-05 20:20:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uploads data async from an URL and converts the response to an object
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">The Type which the object gets converted to</typeparam>
|
|
|
|
|
/// <param name="url">An URL</param>
|
|
|
|
|
/// <param name="body">The Body-Data (most likely a JSON String)</param>
|
|
|
|
|
/// <param name="method">The Upload-method (POST,DELETE,PUT)</param>
|
|
|
|
|
/// <returns></returns>
|
2016-07-07 20:23:36 +01:00
|
|
|
|
Task<Tuple<ResponseInfo, T>> UploadJsonAsync<T>(string url, string body, string method);
|
2015-11-05 20:20:22 +00:00
|
|
|
|
|
2015-07-07 17:11:11 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sets a specific Header
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="header">Header name</param>
|
|
|
|
|
/// <param name="value">Header value</param>
|
|
|
|
|
void SetHeader(string header, string value);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes a specific Header
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="header">Header name</param>
|
|
|
|
|
void RemoveHeader(string header);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all current Headers
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A collection of Header KeyValue Pairs</returns>
|
|
|
|
|
List<KeyValuePair<string, string>> GetHeaders();
|
|
|
|
|
}
|
|
|
|
|
}
|