| | | 1 | | using System.Collections.Generic; |
| | | 2 | | using System.Net.Mime; |
| | | 3 | | using Jellyfin.Api.Results; |
| | | 4 | | using Jellyfin.Extensions.Json; |
| | | 5 | | using Microsoft.AspNetCore.Mvc; |
| | | 6 | | |
| | | 7 | | namespace Jellyfin.Api; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Base api controller for the API setting a default route. |
| | | 11 | | /// </summary> |
| | | 12 | | [ApiController] |
| | | 13 | | [Route("[controller]")] |
| | | 14 | | [Produces( |
| | | 15 | | MediaTypeNames.Application.Json, |
| | | 16 | | JsonDefaults.CamelCaseMediaType, |
| | | 17 | | JsonDefaults.PascalCaseMediaType)] |
| | | 18 | | public class BaseJellyfinApiController : ControllerBase |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// Create a new <see cref="OkResult{T}"/>. |
| | | 22 | | /// </summary> |
| | | 23 | | /// <param name="value">The value to return.</param> |
| | | 24 | | /// <typeparam name="T">The type to return.</typeparam> |
| | | 25 | | /// <returns>The <see cref="ActionResult{T}"/>.</returns> |
| | | 26 | | protected ActionResult<IEnumerable<T>> Ok<T>(IEnumerable<T>? value) |
| | 5 | 27 | | => new OkResult<IEnumerable<T>?>(value); |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Create a new <see cref="OkResult{T}"/>. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="value">The value to return.</param> |
| | | 33 | | /// <typeparam name="T">The type to return.</typeparam> |
| | | 34 | | /// <returns>The <see cref="ActionResult{T}"/>.</returns> |
| | | 35 | | protected ActionResult<T> Ok<T>(T value) |
| | 0 | 36 | | => new OkResult<T>(value); |
| | | 37 | | } |