diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-09-11 15:37:14 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-09-11 15:37:14 -0400 |
| commit | f1e668bad82ff591ed4135459c4f26ae500a4025 (patch) | |
| tree | 4857d3c3a0fd110b3a5821fcb143168d40975669 /MediaBrowser.ApiInteraction | |
| parent | 670a53258ef79ee92f578335577df4f768c9d7d4 (diff) | |
More code cleanups
Diffstat (limited to 'MediaBrowser.ApiInteraction')
| -rw-r--r-- | MediaBrowser.ApiInteraction/ApiClient.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.ApiInteraction/BaseApiClient.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.ApiInteraction/BaseHttpApiClient.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.ApiInteraction/DataSerializer.cs | 12 |
4 files changed, 27 insertions, 27 deletions
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs index 14326ba40c..3d5ecde22b 100644 --- a/MediaBrowser.ApiInteraction/ApiClient.cs +++ b/MediaBrowser.ApiInteraction/ApiClient.cs @@ -11,7 +11,7 @@ namespace MediaBrowser.ApiInteraction }
public ApiClient()
- : this(new WebRequestHandler() { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate) })
+ : this(new WebRequestHandler { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate) })
{
}
}
diff --git a/MediaBrowser.ApiInteraction/BaseApiClient.cs b/MediaBrowser.ApiInteraction/BaseApiClient.cs index 18588e9204..683aa7e93c 100644 --- a/MediaBrowser.ApiInteraction/BaseApiClient.cs +++ b/MediaBrowser.ApiInteraction/BaseApiClient.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.ApiInteraction /// </summary>
public abstract class BaseApiClient : IDisposable
{
- public BaseApiClient()
+ protected BaseApiClient()
{
DataSerializer.Configure();
}
@@ -45,7 +45,7 @@ namespace MediaBrowser.ApiInteraction {
get
{
- return ApiInteraction.SerializationFormats.Protobuf;
+ return SerializationFormats.Protobuf;
}
}
@@ -301,8 +301,8 @@ namespace MediaBrowser.ApiInteraction /// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
public string[] GetBackdropImageUrls(DtoBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
{
- Guid? backdropItemId = null;
- int backdropCount = 0;
+ Guid? backdropItemId;
+ int backdropCount;
if (item.BackdropCount == 0)
{
@@ -320,7 +320,7 @@ namespace MediaBrowser.ApiInteraction return new string[] { };
}
- string[] files = new string[backdropCount];
+ var files = new string[backdropCount];
for (int i = 0; i < backdropCount; i++)
{
diff --git a/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs b/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs index 6bc052afcb..8c6c1c2971 100644 --- a/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs +++ b/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs @@ -28,7 +28,7 @@ namespace MediaBrowser.ApiInteraction private WebClient HttpClient { get; set; }
#else
- public BaseHttpApiClient(HttpClientHandler handler)
+ protected BaseHttpApiClient(HttpClientHandler handler)
: base()
{
handler.AutomaticDecompression = DecompressionMethods.Deflate;
@@ -81,13 +81,13 @@ namespace MediaBrowser.ApiInteraction /// <summary>
/// Gets all Genres
/// </summary>
- public async Task<IBNItem[]> GetAllGenresAsync(Guid userId)
+ public async Task<IbnItem[]> GetAllGenresAsync(Guid userId)
{
string url = ApiUrl + "/genres?userId=" + userId.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem[]>(stream);
+ return DeserializeFromStream<IbnItem[]>(stream);
}
}
@@ -174,13 +174,13 @@ namespace MediaBrowser.ApiInteraction /// <summary>
/// Gets all Years
/// </summary>
- public async Task<IBNItem[]> GetAllYearsAsync(Guid userId)
+ public async Task<IbnItem[]> GetAllYearsAsync(Guid userId)
{
string url = ApiUrl + "/years?userId=" + userId.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem[]>(stream);
+ return DeserializeFromStream<IbnItem[]>(stream);
}
}
@@ -265,13 +265,13 @@ namespace MediaBrowser.ApiInteraction /// <summary>
/// Gets all studious
/// </summary>
- public async Task<IBNItem[]> GetAllStudiosAsync(Guid userId)
+ public async Task<IbnItem[]> GetAllStudiosAsync(Guid userId)
{
string url = ApiUrl + "/studios?userId=" + userId.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem[]>(stream);
+ return DeserializeFromStream<IbnItem[]>(stream);
}
}
@@ -297,52 +297,52 @@ namespace MediaBrowser.ApiInteraction /// <summary>
/// Gets a studio
/// </summary>
- public async Task<IBNItem> GetStudioAsync(Guid userId, string name)
+ public async Task<IbnItem> GetStudioAsync(Guid userId, string name)
{
string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
/// <summary>
/// Gets a genre
/// </summary>
- public async Task<IBNItem> GetGenreAsync(Guid userId, string name)
+ public async Task<IbnItem> GetGenreAsync(Guid userId, string name)
{
string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
/// <summary>
/// Gets a person
/// </summary>
- public async Task<IBNItem> GetPersonAsync(Guid userId, string name)
+ public async Task<IbnItem> GetPersonAsync(Guid userId, string name)
{
string url = ApiUrl + "/person?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
/// <summary>
/// Gets a year
/// </summary>
- public async Task<IBNItem> GetYearAsync(Guid userId, int year)
+ public async Task<IbnItem> GetYearAsync(Guid userId, int year)
{
string url = ApiUrl + "/year?userId=" + userId.ToString() + "&year=" + year;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
diff --git a/MediaBrowser.ApiInteraction/DataSerializer.cs b/MediaBrowser.ApiInteraction/DataSerializer.cs index 2783f4ea12..3c3f8fae2f 100644 --- a/MediaBrowser.ApiInteraction/DataSerializer.cs +++ b/MediaBrowser.ApiInteraction/DataSerializer.cs @@ -25,11 +25,11 @@ namespace MediaBrowser.ApiInteraction //return Serializer.Deserialize<T>(stream);
return ProtobufModelSerializer.Deserialize(stream, null, typeof(T)) as T;
}
- else if (format == SerializationFormats.Jsv)
+ if (format == SerializationFormats.Jsv)
{
return TypeSerializer.DeserializeFromStream<T>(stream);
}
- else if (format == SerializationFormats.Json)
+ if (format == SerializationFormats.Json)
{
return JsonSerializer.DeserializeFromStream<T>(stream);
}
@@ -42,16 +42,16 @@ namespace MediaBrowser.ApiInteraction /// </summary>
public static object DeserializeFromStream(Stream stream, SerializationFormats format, Type type)
{
- if (format == ApiInteraction.SerializationFormats.Protobuf)
+ if (format == SerializationFormats.Protobuf)
{
//throw new NotImplementedException();
return ProtobufModelSerializer.Deserialize(stream, null, type);
}
- else if (format == ApiInteraction.SerializationFormats.Jsv)
+ if (format == SerializationFormats.Jsv)
{
return TypeSerializer.DeserializeFromStream(type, stream);
}
- else if (format == ApiInteraction.SerializationFormats.Json)
+ if (format == SerializationFormats.Json)
{
return JsonSerializer.DeserializeFromStream(type, stream);
}
@@ -61,7 +61,7 @@ namespace MediaBrowser.ApiInteraction public static void Configure()
{
- JsConfig.DateHandler = ServiceStack.Text.JsonDateHandler.ISO8601;
+ JsConfig.DateHandler = JsonDateHandler.ISO8601;
JsConfig.ExcludeTypeInfo = true;
JsConfig.IncludeNullValues = false;
}
|
