aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ApiInteraction/ApiClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ApiInteraction/ApiClient.cs')
-rw-r--r--MediaBrowser.ApiInteraction/ApiClient.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs
index e7d4e6eff..5268c7e1f 100644
--- a/MediaBrowser.ApiInteraction/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction/ApiClient.cs
@@ -46,6 +46,15 @@ namespace MediaBrowser.ApiInteraction
}
/// <summary>
+ /// Initializes a new instance of the <see cref="ApiClient" /> class.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ public ApiClient(ILogger logger)
+ : this(logger, new AsyncHttpClient())
+ {
+ }
+
+ /// <summary>
/// Sets the authorization header.
/// </summary>
/// <param name="header">The header.</param>
@@ -67,7 +76,7 @@ namespace MediaBrowser.ApiInteraction
throw new ArgumentNullException("url");
}
- return HttpClient.GetStreamAsync(url, Logger, CancellationToken.None);
+ return HttpClient.GetAsync(url, Logger, CancellationToken.None);
}
/// <summary>
@@ -364,7 +373,7 @@ namespace MediaBrowser.ApiInteraction
var url = GetApiUrl("Plugins/" + plugin.Id + "/Assembly");
- return HttpClient.GetStreamAsync(url, Logger, CancellationToken.None);
+ return HttpClient.GetAsync(url, Logger, CancellationToken.None);
}
/// <summary>
@@ -431,7 +440,7 @@ namespace MediaBrowser.ApiInteraction
var url = GetApiUrl("Plugins/" + pluginId + "/ConfigurationFile");
- return await HttpClient.GetStreamAsync(url, Logger, CancellationToken.None).ConfigureAwait(false);
+ return await HttpClient.GetAsync(url, Logger, CancellationToken.None).ConfigureAwait(false);
}
/// <summary>
@@ -963,7 +972,7 @@ namespace MediaBrowser.ApiInteraction
const string contentType = "application/x-www-form-urlencoded";
- var postContent = DataSerializer.SerializeToJsonString(obj);
+ var postContent = SerializeToJson(obj);
using (var stream = await HttpClient.PostAsync(url, contentType, postContent, Logger, CancellationToken.None).ConfigureAwait(false))
{
@@ -991,7 +1000,7 @@ namespace MediaBrowser.ApiInteraction
{
url = AddDataFormat(url, serializationFormat);
- return HttpClient.GetStreamAsync(url, Logger, CancellationToken.None);
+ return HttpClient.GetAsync(url, Logger, CancellationToken.None);
}