From c6b381db1098041fe975f9830728bf1f000ce71f Mon Sep 17 00:00:00 2001 From: crobibero Date: Sun, 13 Dec 2020 08:32:33 -0700 Subject: [PATCH] Use request body for mapping xml channels --- Jellyfin.Api/Controllers/LiveTvController.cs | 11 ++------ .../Models/LiveTvDtos/SetChannelMappingDto.cs | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs index 56d4b3933e..6f2d432277 100644 --- a/Jellyfin.Api/Controllers/LiveTvController.cs +++ b/Jellyfin.Api/Controllers/LiveTvController.cs @@ -1119,20 +1119,15 @@ namespace Jellyfin.Api.Controllers /// /// Set channel mappings. /// - /// Provider id. - /// Tuner channel id. - /// Provider channel id. + /// The set channel mapping dto. /// Created channel mapping returned. /// An containing the created channel mapping. [HttpPost("ChannelMappings")] [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task> SetChannelMapping( - [FromQuery] string? providerId, - [FromQuery] string? tunerChannelId, - [FromQuery] string? providerChannelId) + public async Task> SetChannelMapping([FromBody, Required] SetChannelMappingDto setChannelMappingDto) { - return await _liveTvManager.SetChannelMapping(providerId, tunerChannelId, providerChannelId).ConfigureAwait(false); + return await _liveTvManager.SetChannelMapping(setChannelMappingDto.ProviderId, setChannelMappingDto.TunerChannelId, setChannelMappingDto.ProviderChannelId).ConfigureAwait(false); } /// diff --git a/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs b/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs new file mode 100644 index 0000000000..2ddaa89e8b --- /dev/null +++ b/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs @@ -0,0 +1,28 @@ +using System.ComponentModel.DataAnnotations; + +namespace Jellyfin.Api.Models.LiveTvDtos +{ + /// + /// Set channel mapping dto. + /// + public class SetChannelMappingDto + { + /// + /// Gets or sets the provider id. + /// + [Required] + public string ProviderId { get; set; } = string.Empty; + + /// + /// Gets or sets the tuner channel id. + /// + [Required] + public string TunerChannelId { get; set; } = string.Empty; + + /// + /// Gets or sets the provider channel id. + /// + [Required] + public string ProviderChannelId { get; set; } = string.Empty; + } +} \ No newline at end of file