TmdbController.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Net.Mime;
  2. using System.Threading.Tasks;
  3. using Microsoft.AspNetCore.Authorization;
  4. using Microsoft.AspNetCore.Http;
  5. using Microsoft.AspNetCore.Mvc;
  6. using TMDbLib.Objects.General;
  7. namespace MediaBrowser.Providers.Plugins.Tmdb.Api
  8. {
  9. /// <summary>
  10. /// The TMDb api controller.
  11. /// </summary>
  12. [ApiController]
  13. [Authorize(Policy = "DefaultAuthorization")]
  14. [Route("[controller]")]
  15. [Produces(MediaTypeNames.Application.Json)]
  16. public class TmdbController : ControllerBase
  17. {
  18. private readonly TmdbClientManager _tmdbClientManager;
  19. /// <summary>
  20. /// Initializes a new instance of the <see cref="TmdbController"/> class.
  21. /// </summary>
  22. /// <param name="tmdbClientManager">The TMDb client manager.</param>
  23. public TmdbController(TmdbClientManager tmdbClientManager)
  24. {
  25. _tmdbClientManager = tmdbClientManager;
  26. }
  27. /// <summary>
  28. /// Gets the TMDb image configuration options.
  29. /// </summary>
  30. /// <returns>The image portion of the TMDb client configuration.</returns>
  31. [HttpGet("ClientConfiguration")]
  32. [ProducesResponseType(StatusCodes.Status200OK)]
  33. public async Task<ConfigImageTypes> TmdbClientConfiguration()
  34. {
  35. return (await _tmdbClientManager.GetClientConfiguration().ConfigureAwait(false)).Images;
  36. }
  37. }
  38. }