diff options
Diffstat (limited to 'src/Endpoints')
| -rw-r--r-- | src/Endpoints/GetRadioSeriesDetails.cs | 26 | ||||
| -rw-r--r-- | src/Endpoints/GetRadioSeriesList.cs | 14 |
2 files changed, 38 insertions, 2 deletions
diff --git a/src/Endpoints/GetRadioSeriesDetails.cs b/src/Endpoints/GetRadioSeriesDetails.cs new file mode 100644 index 0000000..0bdbd6c --- /dev/null +++ b/src/Endpoints/GetRadioSeriesDetails.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; + +namespace I2R.LightNews.Endpoints; + +public class GetRadioSeriesDetails : EndpointBase +{ + private readonly NrkRadioService _radio; + + public GetRadioSeriesDetails(NrkRadioService radio) { + _radio = radio; + } + + public class Response + { + public List<RadioSeason> Seasons { get; set; } + public List<RadioEpisode> Episodes { get; set; } + } + + [HttpGet("~/radio-series/{id:int}")] + public ActionResult GetRadioSeries(int id) { + var series = RadioIndexDb.GetSeriesById(id); + if (series == default) { + return NoContent(); + } + } +}
\ No newline at end of file diff --git a/src/Endpoints/GetRadioSeriesList.cs b/src/Endpoints/GetRadioSeriesList.cs index 7898f25..1005a45 100644 --- a/src/Endpoints/GetRadioSeriesList.cs +++ b/src/Endpoints/GetRadioSeriesList.cs @@ -6,8 +6,18 @@ public class RadioSearchEndpoint : EndpointBase { public RadioSearchEndpoint() { } + public class Response + { + public int Id { get; set; } + public string Name { get; set; } + } + [HttpGet("~/radio-series")] - public async Task<ActionResult> HandleAsync(string q) { - return Ok(RadioIndexDb.GetSeries(q)); + public async Task<ActionResult<List<Response>>> HandleAsync(string q) { + var series = RadioIndexDb.GetSeries(q); + return Ok(series.Select(c => new Response() { + Id = c.Id, + Name = c.Name + })); } }
\ No newline at end of file |
