Use ActionResult return type for all endpoints

pull/2876/head
ZadenRB 5 years ago
parent 2a49b19a7c
commit 7693cc0db0

@ -43,8 +43,8 @@ namespace Jellyfin.Api.Controllers
/// <param name="limit">An optional limit on the number of notifications returned.</param> /// <param name="limit">An optional limit on the number of notifications returned.</param>
/// <returns>A read-only list of all of the user's notifications.</returns> /// <returns>A read-only list of all of the user's notifications.</returns>
[HttpGet("{UserID}")] [HttpGet("{UserID}")]
[ProducesResponseType(typeof(NotificationResultDto), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public NotificationResultDto GetNotifications( public ActionResult<NotificationResultDto> GetNotifications(
[FromRoute] string userId, [FromRoute] string userId,
[FromQuery] bool? isRead, [FromQuery] bool? isRead,
[FromQuery] int? startIndex, [FromQuery] int? startIndex,
@ -59,8 +59,8 @@ namespace Jellyfin.Api.Controllers
/// <param name="userId">The user's ID.</param> /// <param name="userId">The user's ID.</param>
/// <returns>Notifications summary for the user.</returns> /// <returns>Notifications summary for the user.</returns>
[HttpGet("{UserID}/Summary")] [HttpGet("{UserID}/Summary")]
[ProducesResponseType(typeof(NotificationsSummaryDto), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public NotificationsSummaryDto GetNotificationsSummary( public ActionResult<NotificationsSummaryDto> GetNotificationsSummary(
[FromRoute] string userId) [FromRoute] string userId)
{ {
return new NotificationsSummaryDto(); return new NotificationsSummaryDto();
@ -71,8 +71,8 @@ namespace Jellyfin.Api.Controllers
/// </summary> /// </summary>
/// <returns>All notification types.</returns> /// <returns>All notification types.</returns>
[HttpGet("Types")] [HttpGet("Types")]
[ProducesResponseType(typeof(IEnumerable<NotificationTypeInfo>), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public IEnumerable<NotificationTypeInfo> GetNotificationTypes() public ActionResult<IEnumerable<NotificationTypeInfo>> GetNotificationTypes()
{ {
return _notificationManager.GetNotificationTypes(); return _notificationManager.GetNotificationTypes();
} }
@ -82,10 +82,10 @@ namespace Jellyfin.Api.Controllers
/// </summary> /// </summary>
/// <returns>All notification services.</returns> /// <returns>All notification services.</returns>
[HttpGet("Services")] [HttpGet("Services")]
[ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public IEnumerable<NameIdPair> GetNotificationServices() public ActionResult<IEnumerable<NameIdPair>> GetNotificationServices()
{ {
return _notificationManager.GetNotificationServices(); return _notificationManager.GetNotificationServices().ToList();
} }
/// <summary> /// <summary>
@ -97,7 +97,7 @@ namespace Jellyfin.Api.Controllers
/// <param name="level">The level of the notification.</param> /// <param name="level">The level of the notification.</param>
[HttpPost("Admin")] [HttpPost("Admin")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public void CreateAdminNotification( public ActionResult CreateAdminNotification(
[FromQuery] string name, [FromQuery] string name,
[FromQuery] string description, [FromQuery] string description,
[FromQuery] string? url, [FromQuery] string? url,
@ -114,6 +114,8 @@ namespace Jellyfin.Api.Controllers
}; };
_notificationManager.SendNotification(notification, CancellationToken.None); _notificationManager.SendNotification(notification, CancellationToken.None);
return Ok();
} }
/// <summary> /// <summary>
@ -123,10 +125,11 @@ namespace Jellyfin.Api.Controllers
/// <param name="ids">A comma-separated list of the IDs of notifications which should be set as read.</param> /// <param name="ids">A comma-separated list of the IDs of notifications which should be set as read.</param>
[HttpPost("{UserID}/Read")] [HttpPost("{UserID}/Read")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public void SetRead( public ActionResult SetRead(
[FromRoute] string userId, [FromRoute] string userId,
[FromQuery] string ids) [FromQuery] string ids)
{ {
return Ok();
} }
/// <summary> /// <summary>
@ -136,10 +139,11 @@ namespace Jellyfin.Api.Controllers
/// <param name="ids">A comma-separated list of the IDs of notifications which should be set as unread.</param> /// <param name="ids">A comma-separated list of the IDs of notifications which should be set as unread.</param>
[HttpPost("{UserID}/Unread")] [HttpPost("{UserID}/Unread")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public void SetUnread( public ActionResult SetUnread(
[FromRoute] string userId, [FromRoute] string userId,
[FromQuery] string ids) [FromQuery] string ids)
{ {
return Ok();
} }
} }
} }

Loading…
Cancel
Save