2012-07-31 16:29:07 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.ApiInteraction
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides a base class used by the api and image services
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract class BaseClient : IDisposable
|
|
|
|
|
{
|
|
|
|
|
public string ApiUrl { get; set; }
|
|
|
|
|
|
|
|
|
|
protected HttpClient HttpClient { get; private set; }
|
|
|
|
|
|
|
|
|
|
public BaseClient()
|
2012-08-01 01:53:40 +00:00
|
|
|
|
: this(new HttpClientHandler())
|
2012-07-31 16:29:07 +00:00
|
|
|
|
{
|
2012-08-01 01:53:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseClient(HttpClientHandler clientHandler)
|
|
|
|
|
{
|
|
|
|
|
clientHandler.AutomaticDecompression = System.Net.DecompressionMethods.GZip;
|
|
|
|
|
|
|
|
|
|
HttpClient = new HttpClient(clientHandler);
|
2012-07-31 16:29:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
HttpClient.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|