Add episodes controller
This commit is contained in:
19
EstusShots.Shared/Interfaces/IEpisodesController.cs
Normal file
19
EstusShots.Shared/Interfaces/IEpisodesController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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{}
|
||||
}
|
||||
51
EstusShots.Shared/Models/Parameters/EpisodeParameters.cs
Normal file
51
EstusShots.Shared/Models/Parameters/EpisodeParameters.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user