Move SyncPlay request DTOs to proper namespace

This commit is contained in:
Ionut Andrei Oanca 2020-12-03 19:01:57 +01:00
parent 389367fec8
commit 7169c0a22d
18 changed files with 89 additions and 85 deletions

View File

@ -4,13 +4,13 @@ using System.ComponentModel.DataAnnotations;
using System.Threading;
using Jellyfin.Api.Constants;
using Jellyfin.Api.Helpers;
using Jellyfin.Api.Models.SyncPlayDtos;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.Controller.SyncPlay.PlaybackRequests;
using MediaBrowser.Controller.SyncPlay.Requests;
using MediaBrowser.Model.SyncPlay;
using MediaBrowser.Model.SyncPlay.RequestBodies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ -53,7 +53,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)]
[Authorize(Policy = Policies.SyncPlayCreateGroupAccess)]
public ActionResult SyncPlayCreateGroup(
[FromBody, Required] NewGroupRequestBody requestData)
[FromBody, Required] NewGroupRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new NewGroupRequest(requestData.GroupName);
@ -70,7 +70,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Join")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayJoinGroup(
[FromBody, Required] JoinGroupRequestBody requestData)
[FromBody, Required] JoinGroupRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new JoinGroupRequest(requestData.GroupId);
@ -116,7 +116,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("SetNewQueue")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlaySetNewQueue(
[FromBody, Required] PlayRequestBody requestData)
[FromBody, Required] PlayRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new PlayGroupRequest(
@ -136,7 +136,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("SetPlaylistItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlaySetPlaylistItem(
[FromBody, Required] SetPlaylistItemRequestBody requestData)
[FromBody, Required] SetPlaylistItemRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new SetPlaylistItemGroupRequest(requestData.PlaylistItemId);
@ -153,7 +153,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("RemoveFromPlaylist")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayRemoveFromPlaylist(
[FromBody, Required] RemoveFromPlaylistRequestBody requestData)
[FromBody, Required] RemoveFromPlaylistRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new RemoveFromPlaylistGroupRequest(requestData.PlaylistItemIds);
@ -170,7 +170,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("MovePlaylistItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayMovePlaylistItem(
[FromBody, Required] MovePlaylistItemRequestBody requestData)
[FromBody, Required] MovePlaylistItemRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new MovePlaylistItemGroupRequest(requestData.PlaylistItemId, requestData.NewIndex);
@ -187,7 +187,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Queue")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayQueue(
[FromBody, Required] QueueRequestBody requestData)
[FromBody, Required] QueueRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new QueueGroupRequest(requestData.ItemIds, requestData.Mode);
@ -249,7 +249,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Seek")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlaySeek(
[FromBody, Required] SeekRequestBody requestData)
[FromBody, Required] SeekRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new SeekGroupRequest(requestData.PositionTicks);
@ -266,7 +266,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Buffering")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayBuffering(
[FromBody, Required] BufferRequestBody requestData)
[FromBody, Required] BufferRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new BufferGroupRequest(
@ -287,7 +287,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Ready")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayReady(
[FromBody, Required] ReadyRequestBody requestData)
[FromBody, Required] ReadyRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new ReadyGroupRequest(
@ -308,7 +308,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("SetIgnoreWait")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlaySetIgnoreWait(
[FromBody, Required] IgnoreWaitRequestBody requestData)
[FromBody, Required] IgnoreWaitRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new IgnoreWaitGroupRequest(requestData.IgnoreWait);
@ -325,7 +325,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("NextItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayNextItem(
[FromBody, Required] NextItemRequestBody requestData)
[FromBody, Required] NextItemRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new NextItemGroupRequest(requestData.PlaylistItemId);
@ -342,7 +342,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("PreviousItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayPreviousItem(
[FromBody, Required] PreviousItemRequestBody requestData)
[FromBody, Required] PreviousItemRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new PreviousItemGroupRequest(requestData.PlaylistItemId);
@ -359,7 +359,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("SetRepeatMode")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlaySetRepeatMode(
[FromBody, Required] SetRepeatModeRequestBody requestData)
[FromBody, Required] SetRepeatModeRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new SetRepeatModeGroupRequest(requestData.Mode);
@ -376,7 +376,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("SetShuffleMode")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlaySetShuffleMode(
[FromBody, Required] SetShuffleModeRequestBody requestData)
[FromBody, Required] SetShuffleModeRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new SetShuffleModeGroupRequest(requestData.Mode);
@ -393,7 +393,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Ping")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayPing(
[FromBody, Required] PingRequestBody requestData)
[FromBody, Required] PingRequestDto requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new PingGroupRequest(requestData.Ping);

View File

@ -1,16 +1,16 @@
using System;
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class BufferRequestBody.
/// Class BufferRequestDto.
/// </summary>
public class BufferRequestBody
public class BufferRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="BufferRequestBody"/> class.
/// Initializes a new instance of the <see cref="BufferRequestDto"/> class.
/// </summary>
public BufferRequestBody()
public BufferRequestDto()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,9 +1,9 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class IgnoreWaitRequestBody.
/// Class IgnoreWaitRequestDto.
/// </summary>
public class IgnoreWaitRequestBody
public class IgnoreWaitRequestDto
{
/// <summary>
/// Gets or sets a value indicating whether the client should be ignored.

View File

@ -1,11 +1,11 @@
using System;
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class JoinGroupRequestBody.
/// Class JoinGroupRequestDto.
/// </summary>
public class JoinGroupRequestBody
public class JoinGroupRequestDto
{
/// <summary>
/// Gets or sets the group identifier.

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class MovePlaylistItemRequestBody.
/// Class MovePlaylistItemRequestDto.
/// </summary>
public class MovePlaylistItemRequestBody
public class MovePlaylistItemRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="MovePlaylistItemRequestBody"/> class.
/// Initializes a new instance of the <see cref="MovePlaylistItemRequestDto"/> class.
/// </summary>
public MovePlaylistItemRequestBody()
public MovePlaylistItemRequestDto()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class NewGroupRequestBody.
/// Class NewGroupRequestDto.
/// </summary>
public class NewGroupRequestBody
public class NewGroupRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="NewGroupRequestBody"/> class.
/// Initializes a new instance of the <see cref="NewGroupRequestDto"/> class.
/// </summary>
public NewGroupRequestBody()
public NewGroupRequestDto()
{
GroupName = string.Empty;
}

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class NextItemRequestBody.
/// Class NextItemRequestDto.
/// </summary>
public class NextItemRequestBody
public class NextItemRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="NextItemRequestBody"/> class.
/// Initializes a new instance of the <see cref="NextItemRequestDto"/> class.
/// </summary>
public NextItemRequestBody()
public NextItemRequestDto()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,9 +1,9 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class PingRequestBody.
/// Class PingRequestDto.
/// </summary>
public class PingRequestBody
public class PingRequestDto
{
/// <summary>
/// Gets or sets the ping time.

View File

@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class PlayRequestBody.
/// Class PlayRequestDto.
/// </summary>
public class PlayRequestBody
public class PlayRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="PlayRequestBody"/> class.
/// Initializes a new instance of the <see cref="PlayRequestDto"/> class.
/// </summary>
public PlayRequestBody()
public PlayRequestDto()
{
PlayingQueue = Array.Empty<Guid>();
}

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class PreviousItemRequestBody.
/// Class PreviousItemRequestDto.
/// </summary>
public class PreviousItemRequestBody
public class PreviousItemRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviousItemRequestBody"/> class.
/// Initializes a new instance of the <see cref="PreviousItemRequestDto"/> class.
/// </summary>
public PreviousItemRequestBody()
public PreviousItemRequestDto()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class QueueRequestBody.
/// Class QueueRequestDto.
/// </summary>
public class QueueRequestBody
public class QueueRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="QueueRequestBody"/> class.
/// Initializes a new instance of the <see cref="QueueRequestDto"/> class.
/// </summary>
public QueueRequestBody()
public QueueRequestDto()
{
ItemIds = Array.Empty<Guid>();
}

View File

@ -1,16 +1,16 @@
using System;
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class ReadyRequest.
/// </summary>
public class ReadyRequestBody
public class ReadyRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="ReadyRequestBody"/> class.
/// Initializes a new instance of the <see cref="ReadyRequestDto"/> class.
/// </summary>
public ReadyRequestBody()
public ReadyRequestDto()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class RemoveFromPlaylistRequestBody.
/// Class RemoveFromPlaylistRequestDto.
/// </summary>
public class RemoveFromPlaylistRequestBody
public class RemoveFromPlaylistRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="RemoveFromPlaylistRequestBody"/> class.
/// Initializes a new instance of the <see cref="RemoveFromPlaylistRequestDto"/> class.
/// </summary>
public RemoveFromPlaylistRequestBody()
public RemoveFromPlaylistRequestDto()
{
PlaylistItemIds = Array.Empty<string>();
}

View File

@ -1,9 +1,9 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class SeekRequestBody.
/// Class SeekRequestDto.
/// </summary>
public class SeekRequestBody
public class SeekRequestDto
{
/// <summary>
/// Gets or sets the position ticks.

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class SetPlaylistItemRequestBody.
/// Class SetPlaylistItemRequestDto.
/// </summary>
public class SetPlaylistItemRequestBody
public class SetPlaylistItemRequestDto
{
/// <summary>
/// Initializes a new instance of the <see cref="SetPlaylistItemRequestBody"/> class.
/// Initializes a new instance of the <see cref="SetPlaylistItemRequestDto"/> class.
/// </summary>
public SetPlaylistItemRequestBody()
public SetPlaylistItemRequestDto()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,9 +1,11 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
using MediaBrowser.Model.SyncPlay;
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class SetRepeatModeRequestBody.
/// Class SetRepeatModeRequestDto.
/// </summary>
public class SetRepeatModeRequestBody
public class SetRepeatModeRequestDto
{
/// <summary>
/// Gets or sets the repeat mode.

View File

@ -1,9 +1,11 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
using MediaBrowser.Model.SyncPlay;
namespace Jellyfin.Api.Models.SyncPlayDtos
{
/// <summary>
/// Class SetShuffleModeRequestBody.
/// Class SetShuffleModeRequestDto.
/// </summary>
public class SetShuffleModeRequestBody
public class SetShuffleModeRequestDto
{
/// <summary>
/// Gets or sets the shuffle mode.

View File

@ -4,7 +4,6 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.SyncPlay.Requests;
using MediaBrowser.Model.SyncPlay;
using MediaBrowser.Model.SyncPlay.RequestBodies;
namespace MediaBrowser.Controller.SyncPlay
{