aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins/Tmdb/Api/TmdbController.cs
blob: 0bab7c3cadf9674f856192e1b8d0c58cebbb1d47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Net.Mime;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TMDbLib.Objects.General;

namespace MediaBrowser.Providers.Plugins.Tmdb.Api
{
    /// <summary>
    /// The TMDb api controller.
    /// </summary>
    [ApiController]
    [Authorize(Policy = "DefaultAuthorization")]
    [Route("[controller]")]
    [Produces(MediaTypeNames.Application.Json)]
    public class TmdbController : ControllerBase
    {
        private readonly TmdbClientManager _tmdbClientManager;

        /// <summary>
        /// Initializes a new instance of the <see cref="TmdbController"/> class.
        /// </summary>
        /// <param name="tmdbClientManager">The TMDb client manager.</param>
        public TmdbController(TmdbClientManager tmdbClientManager)
        {
            _tmdbClientManager = tmdbClientManager;
        }

        /// <summary>
        /// Gets the TMDb image configuration options.
        /// </summary>
        /// <returns>The image portion of the TMDb client configuration.</returns>
        [HttpGet("ClientConfiguration")]
        [ProducesResponseType(StatusCodes.Status200OK)]
        public async Task<ConfigImageTypes> TmdbClientConfiguration()
        {
            return (await _tmdbClientManager.GetClientConfiguration().ConfigureAwait(false)).Images;
        }
    }
}