Add episodes controller

This commit is contained in:
2020-02-29 16:01:22 +01:00
parent 0cef2e3df2
commit 54c0fb2fd2
10 changed files with 190 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
using System.Threading.Tasks;
using EstusShots.Shared.Models;
using EstusShots.Shared.Models.Parameters;
namespace EstusShots.Shared.Interfaces
{
/// <summary>
/// Access to episodes
/// </summary>
public interface IEpisodesController
{
/// <summary>
/// Load all episodes for a season
/// </summary>
/// <param name="parameter">The parameter object</param>
/// <returns>The GetEpisodes response object</returns>
Task<ApiResponse<GetEpisodesResponse>> GetEpisodes(GetEpisodesParameter parameter);
}
}

View File

@@ -1,4 +1,5 @@
using System;
using EstusShots.Shared.Interfaces;
namespace EstusShots.Shared.Models
{
@@ -60,4 +61,6 @@ namespace EstusShots.Shared.Models
Data = data;
}
}
public class CriticalErrorResponse :IApiResponse{}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using EstusShots.Shared.Dto;
using EstusShots.Shared.Interfaces;
namespace EstusShots.Shared.Models.Parameters
{
// GetEpisodes
/// <summary>
/// Parameter class for loading all episodes for a season
/// </summary>
public class GetEpisodesParameter : IApiParameter
{
/// <summary>
/// ID of the season for which to load the episode list
/// </summary>
public Guid SeasonId { get; set; }
public GetEpisodesParameter(Guid seasonId)
{
SeasonId = seasonId;
}
public GetEpisodesParameter()
{
SeasonId = Guid.Empty;
}
}
/// <summary>
/// Parameter class returned from the API with all loaded episodes for a season
/// </summary>
public class GetEpisodesResponse : IApiResponse
{
/// <summary>
/// List of all episodes in the requested season
/// </summary>
public List<Episode> Episodes { get; set; }
public GetEpisodesResponse(List<Episode> episodes)
{
Episodes = episodes;
}
public GetEpisodesResponse()
{
Episodes = new List<Episode>();
}
}
}