Add response code documentation

This commit is contained in:
David 2020-07-22 10:20:51 +02:00
parent cbf5c682e9
commit 9996afbf25

View File

@ -9,6 +9,7 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.SyncPlay; using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.Model.SyncPlay; using MediaBrowser.Model.SyncPlay;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Jellyfin.Api.Controllers namespace Jellyfin.Api.Controllers
@ -42,8 +43,10 @@ namespace Jellyfin.Api.Controllers
/// <summary> /// <summary>
/// Create a new SyncPlay group. /// Create a new SyncPlay group.
/// </summary> /// </summary>
/// <response code="204">New group created.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("New")] [HttpPost("New")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult CreateNewGroup() public ActionResult CreateNewGroup()
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -55,8 +58,10 @@ namespace Jellyfin.Api.Controllers
/// Join an existing SyncPlay group. /// Join an existing SyncPlay group.
/// </summary> /// </summary>
/// <param name="groupId">The sync play group id.</param> /// <param name="groupId">The sync play group id.</param>
/// <response code="204">Group join successful.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Join")] [HttpPost("Join")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult JoinGroup([FromQuery, Required] Guid groupId) public ActionResult JoinGroup([FromQuery, Required] Guid groupId)
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -73,8 +78,10 @@ namespace Jellyfin.Api.Controllers
/// <summary> /// <summary>
/// Leave the joined SyncPlay group. /// Leave the joined SyncPlay group.
/// </summary> /// </summary>
/// <response code="204">Group leave successful.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Leave")] [HttpPost("Leave")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult LeaveGroup() public ActionResult LeaveGroup()
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -86,8 +93,10 @@ namespace Jellyfin.Api.Controllers
/// Gets all SyncPlay groups. /// Gets all SyncPlay groups.
/// </summary> /// </summary>
/// <param name="filterItemId">Optional. Filter by item id.</param> /// <param name="filterItemId">Optional. Filter by item id.</param>
/// <response code="200">Groups returned.</response>
/// <returns>An <see cref="IEnumerable{GrouüInfoView}"/> containing the available SyncPlay groups.</returns> /// <returns>An <see cref="IEnumerable{GrouüInfoView}"/> containing the available SyncPlay groups.</returns>
[HttpGet("List")] [HttpGet("List")]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<IEnumerable<GroupInfoView>> GetSyncPlayGroups([FromQuery] Guid? filterItemId) public ActionResult<IEnumerable<GroupInfoView>> GetSyncPlayGroups([FromQuery] Guid? filterItemId)
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -97,8 +106,10 @@ namespace Jellyfin.Api.Controllers
/// <summary> /// <summary>
/// Request play in SyncPlay group. /// Request play in SyncPlay group.
/// </summary> /// </summary>
/// <response code="204">Play request sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost] [HttpPost]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult Play() public ActionResult Play()
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -113,8 +124,10 @@ namespace Jellyfin.Api.Controllers
/// <summary> /// <summary>
/// Request pause in SyncPlay group. /// Request pause in SyncPlay group.
/// </summary> /// </summary>
/// <response code="204">Pause request sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost] [HttpPost]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult Pause() public ActionResult Pause()
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -130,8 +143,10 @@ namespace Jellyfin.Api.Controllers
/// Request seek in SyncPlay group. /// Request seek in SyncPlay group.
/// </summary> /// </summary>
/// <param name="positionTicks">The playback position in ticks.</param> /// <param name="positionTicks">The playback position in ticks.</param>
/// <response code="204">Seek request sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost] [HttpPost]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult Seek([FromQuery] long positionTicks) public ActionResult Seek([FromQuery] long positionTicks)
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -150,8 +165,10 @@ namespace Jellyfin.Api.Controllers
/// <param name="when">When the request has been made by the client.</param> /// <param name="when">When the request has been made by the client.</param>
/// <param name="positionTicks">The playback position in ticks.</param> /// <param name="positionTicks">The playback position in ticks.</param>
/// <param name="bufferingDone">Whether the buffering is done.</param> /// <param name="bufferingDone">Whether the buffering is done.</param>
/// <response code="204">Buffering request sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost] [HttpPost]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult Buffering([FromQuery] DateTime when, [FromQuery] long positionTicks, [FromQuery] bool bufferingDone) public ActionResult Buffering([FromQuery] DateTime when, [FromQuery] long positionTicks, [FromQuery] bool bufferingDone)
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -169,8 +186,10 @@ namespace Jellyfin.Api.Controllers
/// Update session ping. /// Update session ping.
/// </summary> /// </summary>
/// <param name="ping">The ping.</param> /// <param name="ping">The ping.</param>
/// <response code="204">Ping updated.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns> /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost] [HttpPost]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult Ping([FromQuery] double ping) public ActionResult Ping([FromQuery] double ping)
{ {
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);