aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ApiInteraction
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-24 22:56:00 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-24 22:56:00 -0500
commitadd43baffef74fcd34cfc6ef02d36777be05b274 (patch)
treed099801de1b457e3193f5b29b68337ff50649cd8 /MediaBrowser.ApiInteraction
parent2d342c02ef55e2ba8796d95888274356aaadbe5c (diff)
convert media library url's to rest
Diffstat (limited to 'MediaBrowser.ApiInteraction')
-rw-r--r--MediaBrowser.ApiInteraction/ApiClient.cs178
1 files changed, 9 insertions, 169 deletions
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs
index 4f701532b5..e7d4e6eff1 100644
--- a/MediaBrowser.ApiInteraction/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction/ApiClient.cs
@@ -658,7 +658,7 @@ namespace MediaBrowser.ApiInteraction
/// <param name="userId">The user id.</param>
/// <returns>Task{UserItemDataDto}.</returns>
/// <exception cref="System.ArgumentNullException">itemId</exception>
- public Task<UserItemDataDto> ReportPlaybackStartAsync(string itemId, Guid userId)
+ public Task ReportPlaybackStartAsync(string itemId, Guid userId)
{
if (string.IsNullOrEmpty(itemId))
{
@@ -670,14 +670,9 @@ namespace MediaBrowser.ApiInteraction
throw new ArgumentNullException("userId");
}
- var dict = new QueryStringDictionary();
- dict.Add("id", itemId);
- dict.Add("userId", userId);
- dict.Add("type", "start");
-
- var url = GetApiUrl("playbackcheckin", dict);
+ var url = GetApiUrl("Users/" + userId + "/PlayingItems/" + itemId);
- return PostAsync<UserItemDataDto>(url, new Dictionary<string, string>());
+ return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
}
/// <summary>
@@ -688,7 +683,7 @@ namespace MediaBrowser.ApiInteraction
/// <param name="positionTicks">The position ticks.</param>
/// <returns>Task{UserItemDataDto}.</returns>
/// <exception cref="System.ArgumentNullException">itemId</exception>
- public Task<UserItemDataDto> ReportPlaybackProgressAsync(string itemId, Guid userId, long? positionTicks)
+ public Task ReportPlaybackProgressAsync(string itemId, Guid userId, long? positionTicks)
{
if (string.IsNullOrEmpty(itemId))
{
@@ -701,15 +696,11 @@ namespace MediaBrowser.ApiInteraction
}
var dict = new QueryStringDictionary();
- dict.Add("id", itemId);
- dict.Add("userId", userId);
- dict.Add("type", "progress");
-
dict.AddIfNotNull("positionTicks", positionTicks);
- var url = GetApiUrl("playbackcheckin", dict);
+ var url = GetApiUrl("Users/" + userId + "/PlayingItems/" + itemId + "/Progress", dict);
- return PostAsync<UserItemDataDto>(url, new Dictionary<string, string>());
+ return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
}
/// <summary>
@@ -720,7 +711,7 @@ namespace MediaBrowser.ApiInteraction
/// <param name="positionTicks">The position ticks.</param>
/// <returns>Task{UserItemDataDto}.</returns>
/// <exception cref="System.ArgumentNullException">itemId</exception>
- public Task<UserItemDataDto> ReportPlaybackStoppedAsync(string itemId, Guid userId, long? positionTicks)
+ public Task ReportPlaybackStoppedAsync(string itemId, Guid userId, long? positionTicks)
{
if (string.IsNullOrEmpty(itemId))
{
@@ -733,15 +724,11 @@ namespace MediaBrowser.ApiInteraction
}
var dict = new QueryStringDictionary();
- dict.Add("id", itemId);
- dict.Add("userId", userId);
- dict.Add("type", "stopped");
-
dict.AddIfNotNull("positionTicks", positionTicks);
- var url = GetApiUrl("playbackcheckin", dict);
+ var url = GetApiUrl("Users/" + userId + "/PlayingItems/" + itemId, dict);
- return PostAsync<UserItemDataDto>(url, new Dictionary<string, string>());
+ return HttpClient.DeleteAsync(url, Logger, CancellationToken.None);
}
/// <summary>
@@ -879,153 +866,6 @@ namespace MediaBrowser.ApiInteraction
}
/// <summary>
- /// Adds a virtual folder to either the default view or a user view
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="userId">The user id.</param>
- /// <returns>Task{RequestResult}.</returns>
- /// <exception cref="System.ArgumentNullException">name</exception>
- public Task AddVirtualFolderAsync(string name, Guid? userId = null)
- {
- if (string.IsNullOrEmpty(name))
- {
- throw new ArgumentNullException("name");
- }
-
- var dict = new QueryStringDictionary();
- dict.Add("name", name);
- dict.Add("action", "AddVirtualFolder");
-
- dict.AddIfNotNull("userId", userId);
-
- var url = GetApiUrl("UpdateMediaLibrary", dict);
-
- return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
- }
-
- /// <summary>
- /// Removes a virtual folder, within either the default view or a user view
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="userId">The user id.</param>
- /// <returns>Task.</returns>
- /// <exception cref="System.ArgumentNullException">name</exception>
- public Task RemoveVirtualFolderAsync(string name, Guid? userId = null)
- {
- if (string.IsNullOrEmpty(name))
- {
- throw new ArgumentNullException("name");
- }
-
- var dict = new QueryStringDictionary();
- dict.Add("name", name);
- dict.Add("action", "RemoveVirtualFolder");
-
- dict.AddIfNotNull("userId", userId);
-
- var url = GetApiUrl("UpdateMediaLibrary", dict);
-
- return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
- }
-
- /// <summary>
- /// Renames a virtual folder, within either the default view or a user view
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="newName">The new name.</param>
- /// <param name="userId">The user id.</param>
- /// <returns>Task.</returns>
- /// <exception cref="System.ArgumentNullException">name</exception>
- public Task RenameVirtualFolderAsync(string name, string newName, Guid? userId = null)
- {
- if (string.IsNullOrEmpty(name))
- {
- throw new ArgumentNullException("name");
- }
-
- if (string.IsNullOrEmpty(newName))
- {
- throw new ArgumentNullException("newName");
- }
-
- var dict = new QueryStringDictionary();
- dict.Add("name", name);
- dict.Add("newName", newName);
- dict.Add("action", "RenameVirtualFolder");
-
- dict.AddIfNotNull("userId", userId);
-
- var url = GetApiUrl("UpdateMediaLibrary", dict);
-
- return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
- }
-
- /// <summary>
- /// Adds a media path to a virtual folder, within either the default view or a user view
- /// </summary>
- /// <param name="virtualFolderName">Name of the virtual folder.</param>
- /// <param name="mediaPath">The media path.</param>
- /// <param name="userId">The user id.</param>
- /// <returns>Task.</returns>
- /// <exception cref="System.ArgumentNullException">virtualFolderName</exception>
- public Task AddMediaPathAsync(string virtualFolderName, string mediaPath, Guid? userId = null)
- {
- if (string.IsNullOrEmpty(virtualFolderName))
- {
- throw new ArgumentNullException("virtualFolderName");
- }
-
- if (string.IsNullOrEmpty(mediaPath))
- {
- throw new ArgumentNullException("mediaPath");
- }
-
- var dict = new QueryStringDictionary();
- dict.Add("virtualFolderName", virtualFolderName);
- dict.Add("mediaPath", mediaPath);
- dict.Add("action", "AddMediaPath");
-
- dict.AddIfNotNull("userId", userId);
-
- var url = GetApiUrl("UpdateMediaLibrary", dict);
-
- return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
- }
-
- /// <summary>
- /// Removes a media path from a virtual folder, within either the default view or a user view
- /// </summary>
- /// <param name="virtualFolderName">Name of the virtual folder.</param>
- /// <param name="mediaPath">The media path.</param>
- /// <param name="userId">The user id.</param>
- /// <returns>Task.</returns>
- /// <exception cref="System.ArgumentNullException">virtualFolderName</exception>
- public Task RemoveMediaPathAsync(string virtualFolderName, string mediaPath, Guid? userId = null)
- {
- if (string.IsNullOrEmpty(virtualFolderName))
- {
- throw new ArgumentNullException("virtualFolderName");
- }
-
- if (string.IsNullOrEmpty(mediaPath))
- {
- throw new ArgumentNullException("mediaPath");
- }
-
- var dict = new QueryStringDictionary();
-
- dict.Add("virtualFolderName", virtualFolderName);
- dict.Add("mediaPath", mediaPath);
- dict.Add("action", "RemoveMediaPath");
-
- dict.AddIfNotNull("userId", userId);
-
- var url = GetApiUrl("UpdateMediaLibrary", dict);
-
- return PostAsync<EmptyRequestResult>(url, new Dictionary<string, string>());
- }
-
- /// <summary>
/// Updates display preferences for a user
/// </summary>
/// <param name="userId">The user id.</param>