From b7b8cb508431635ff777bcf59d4ab25785471e4f Mon Sep 17 00:00:00 2001 From: 7illusions Date: Sat, 8 Mar 2014 22:36:12 +0100 Subject: [PATCH] Added UserId To API Remotecontrol-calls --- MediaBrowser.Api/SessionsService.cs | 47 ++++++++++++++++++- .../MediaBrowser.Model.Portable.csproj | 7 ++- MediaBrowser.Model/Session/BrowseRequest.cs | 4 ++ MediaBrowser.Model/Session/MessageCommand.cs | 5 +- MediaBrowser.Model/Session/PlayRequest.cs | 12 +++++ .../Session/PlaystateCommand.cs | 3 ++ 6 files changed, 74 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/SessionsService.cs index f662e38170..562e455259 100644 --- a/MediaBrowser.Api/SessionsService.cs +++ b/MediaBrowser.Api/SessionsService.cs @@ -46,6 +46,14 @@ namespace MediaBrowser.Api [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public Guid Id { get; set; } + /// + /// Gets or sets the UserId. + /// + /// The id. + [ApiMember(Name = "UserId", Description = "The controlling User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "POST")] + public Guid UserId { get; set; } + //TODO IsRequired = false shall be changed to true once the clients has been updated and the new ApiClient is in use + /// /// Artist, Genre, Studio, Person, or any kind of BaseItem /// @@ -88,6 +96,14 @@ namespace MediaBrowser.Api [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public Guid Id { get; set; } + /// + /// Gets or sets the UserId. + /// + /// The id. + [ApiMember(Name = "UserId", Description = "The controlling User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "POST")] + public Guid UserId { get; set; } + //TODO IsRequired = false shall be changed to true once the clients has been updated and the new ApiClient is in use + /// /// Artist, Genre, Studio, Person, or any kind of BaseItem /// @@ -121,6 +137,14 @@ namespace MediaBrowser.Api [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public Guid Id { get; set; } + /// + /// Gets or sets the UserId. + /// + /// The id. + [ApiMember(Name = "UserId", Description = "The controlling User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "POST")] + public Guid UserId { get; set; } + //TODO IsRequired = false shall be changed to true once the clients has been updated and the new ApiClient is in use + /// /// Gets or sets the position to seek to /// @@ -146,6 +170,14 @@ namespace MediaBrowser.Api [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public Guid Id { get; set; } + /// + /// Gets or sets the UserId. + /// + /// The id. + [ApiMember(Name = "UserId", Description = "The controlling User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "POST")] + public Guid UserId { get; set; } + //TODO IsRequired = false shall be changed to true once the clients has been updated and the new ApiClient is in use + /// /// Gets or sets the command. /// @@ -165,6 +197,14 @@ namespace MediaBrowser.Api [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public Guid Id { get; set; } + /// + /// Gets or sets the UserId. + /// + /// The id. + [ApiMember(Name = "UserId", Description = "The controlling User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "POST")] + public Guid UserId { get; set; } + //TODO IsRequired = false shall be changed to true once the clients has been updated and the new ApiClient is in use + [ApiMember(Name = "Text", Description = "The message text.", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] public string Text { get; set; } @@ -270,9 +310,10 @@ namespace MediaBrowser.Api } public void Post(SendPlaystateCommand request) - { + { var command = new PlaystateRequest { + UserId = request.UserId, Command = request.Command, SeekPositionTicks = request.SeekPositionTicks }; @@ -290,6 +331,7 @@ namespace MediaBrowser.Api { var command = new BrowseRequest { + UserId = request.UserId, Context = request.Context, ItemId = request.ItemId, ItemName = request.ItemName, @@ -321,6 +363,7 @@ namespace MediaBrowser.Api var command = new MessageCommand { Header = string.IsNullOrEmpty(request.Header) ? "Message from Server" : request.Header, + UserId = request.UserId, TimeoutMs = request.TimeoutMs, Text = request.Text }; @@ -339,7 +382,7 @@ namespace MediaBrowser.Api var command = new PlayRequest { ItemIds = request.ItemIds.Split(',').ToArray(), - + UserId = request.UserId, PlayCommand = request.PlayCommand, StartPositionTicks = request.StartPositionTicks }; diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 04296de355..ccc05492ca 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -11,12 +11,17 @@ MediaBrowser.Model MediaBrowser.Model v4.0 - Profile104 + Profile158 512 {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} ..\ true ..\packages\Fody.1.19.1.0 + + + + + 4.0 true diff --git a/MediaBrowser.Model/Session/BrowseRequest.cs b/MediaBrowser.Model/Session/BrowseRequest.cs index abb3a30abf..03241860c8 100644 --- a/MediaBrowser.Model/Session/BrowseRequest.cs +++ b/MediaBrowser.Model/Session/BrowseRequest.cs @@ -1,4 +1,6 @@  +using System; + namespace MediaBrowser.Model.Session { /// @@ -12,6 +14,8 @@ namespace MediaBrowser.Model.Session /// The type of the item. public string ItemType { get; set; } + public Guid UserId { get; set; } + /// /// Gets or sets the item id. /// diff --git a/MediaBrowser.Model/Session/MessageCommand.cs b/MediaBrowser.Model/Session/MessageCommand.cs index 5ab5808151..754c057faa 100644 --- a/MediaBrowser.Model/Session/MessageCommand.cs +++ b/MediaBrowser.Model/Session/MessageCommand.cs @@ -1,8 +1,11 @@  +using System; namespace MediaBrowser.Model.Session { public class MessageCommand - { + { + public Guid UserId { get; set; } + public string Header { get; set; } public string Text { get; set; } diff --git a/MediaBrowser.Model/Session/PlayRequest.cs b/MediaBrowser.Model/Session/PlayRequest.cs index c9bb586931..239fb65729 100644 --- a/MediaBrowser.Model/Session/PlayRequest.cs +++ b/MediaBrowser.Model/Session/PlayRequest.cs @@ -1,4 +1,5 @@  +using System; namespace MediaBrowser.Model.Session { /// @@ -6,6 +7,11 @@ namespace MediaBrowser.Model.Session /// public class PlayRequest { + public PlayRequest() + { + + } + /// /// Gets or sets the item ids. /// @@ -23,6 +29,12 @@ namespace MediaBrowser.Model.Session /// /// The play command. public PlayCommand PlayCommand { get; set; } + + /// + /// Gets or sets the play command. + /// + /// The play command. + public Guid UserId { get; set; } } /// diff --git a/MediaBrowser.Model/Session/PlaystateCommand.cs b/MediaBrowser.Model/Session/PlaystateCommand.cs index 7e85d9d276..68e80c4521 100644 --- a/MediaBrowser.Model/Session/PlaystateCommand.cs +++ b/MediaBrowser.Model/Session/PlaystateCommand.cs @@ -1,4 +1,5 @@  +using System; namespace MediaBrowser.Model.Session { /// @@ -34,6 +35,8 @@ namespace MediaBrowser.Model.Session public class PlaystateRequest { + public Guid UserId { get; set; } + public PlaystateCommand Command { get; set; } public long? SeekPositionTicks { get; set; }