diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-14 12:06:46 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-14 12:06:46 -0400 |
| commit | ee1fa6e816f0bf836c21a5901bf3d282f6e45dfa (patch) | |
| tree | f81c932fde7ffce5554741725cbe5c3f40d25f14 /MediaBrowser.ApiInteraction/ApiClient.cs | |
| parent | e2fe4174da0b814486a6dac60b066eec8075040d (diff) | |
Implemented some IBN functionality - GetPerson, GetYear, GetStudio, GetGenre
Diffstat (limited to 'MediaBrowser.ApiInteraction/ApiClient.cs')
| -rw-r--r-- | MediaBrowser.ApiInteraction/ApiClient.cs | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs index 5770ee2a4..f8c9170a7 100644 --- a/MediaBrowser.ApiInteraction/ApiClient.cs +++ b/MediaBrowser.ApiInteraction/ApiClient.cs @@ -184,15 +184,41 @@ namespace MediaBrowser.ApiInteraction }
/// <summary>
+ /// Gets all Years
+ /// </summary>
+ public async Task<IEnumerable<CategoryInfo<Year>>> GetAllYearsAsync(Guid userId)
+ {
+ string url = ApiUrl + "/years?userId=" + userId.ToString();
+
+ using (Stream stream = await HttpClient.GetStreamAsync(url))
+ {
+ return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Year>>>(stream);
+ }
+ }
+
+ /// <summary>
+ /// Gets a Year
+ /// </summary>
+ public async Task<IEnumerable<ApiBaseItemWrapper<ApiBaseItem>>> GetItemsWithYearAsync(string name, Guid userId)
+ {
+ string url = ApiUrl + "/itemswithyear?userId=" + userId.ToString() + "&name=" + name;
+
+ using (Stream stream = await HttpClient.GetStreamAsync(url))
+ {
+ return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemWrapper<ApiBaseItem>>>(stream);
+ }
+ }
+
+ /// <summary>
/// Gets a Genre
/// </summary>
- public async Task<CategoryInfo<Genre>> GetGenreAsync(string name, Guid userId)
+ public async Task<IEnumerable<ApiBaseItemWrapper<ApiBaseItem>>> GetItemsWithGenreAsync(string name, Guid userId)
{
- string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
+ string url = ApiUrl + "/itemswithgenre?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await HttpClient.GetStreamAsync(url))
{
- return JsonSerializer.DeserializeFromStream<CategoryInfo<Genre>>(stream);
+ return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemWrapper<ApiBaseItem>>>(stream);
}
}
@@ -225,13 +251,13 @@ namespace MediaBrowser.ApiInteraction /// <summary>
/// Gets a Studio
/// </summary>
- public async Task<CategoryInfo<Studio>> GetStudioAsync(string name, Guid userId)
+ public async Task<IEnumerable<ApiBaseItemWrapper<ApiBaseItem>>> GetItemsWithStudioAsync(string name, Guid userId)
{
- string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
+ string url = ApiUrl + "/itemswithstudio?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await HttpClient.GetStreamAsync(url))
{
- return JsonSerializer.DeserializeFromStream<CategoryInfo<Studio>>(stream);
+ return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemWrapper<ApiBaseItem>>>(stream);
}
}
}
|
