Drinks: models and boilerplate
This commit is contained in:
@@ -24,6 +24,7 @@ namespace EstusShots.Client
|
||||
public Seasons Seasons { get; }
|
||||
public Episodes Episodes { get; }
|
||||
public Players Players { get; }
|
||||
public Drinks Drinks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="EstusShotsClient"/>
|
||||
@@ -37,6 +38,7 @@ namespace EstusShots.Client
|
||||
Seasons = new Seasons(this);
|
||||
Episodes = new Episodes(this);
|
||||
Players = new Players(this);
|
||||
Drinks = new Drinks(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
34
EstusShots.Client/Routes/Drinks.cs
Normal file
34
EstusShots.Client/Routes/Drinks.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using EstusShots.Shared.Interfaces;
|
||||
using EstusShots.Shared.Models;
|
||||
using EstusShots.Shared.Models.Parameters;
|
||||
|
||||
namespace EstusShots.Client.Routes
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class Drinks : IDrinksController
|
||||
{
|
||||
private readonly EstusShotsClient _client;
|
||||
|
||||
public Drinks(EstusShotsClient client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
private string ActionUrl([CallerMemberName]string caller = "") =>
|
||||
$"{_client.ApiUrl}{GetType().Name}/{caller}";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<ApiResponse<GetDrinksResponse>> GetDrinks(GetDrinksParameter parameter)
|
||||
=> await _client.PostToApi<GetDrinksResponse, GetDrinksParameter>(ActionUrl(), parameter);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<ApiResponse<GetDrinkDetailsResponse>> GetDrinkDetails(GetDrinkDetailsParameter parameter)
|
||||
=> await _client.PostToApi<GetDrinkDetailsResponse, GetDrinkDetailsParameter>(ActionUrl(), parameter);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<ApiResponse<SaveDrinkResponse>> SaveDrink(SaveDrinkParameter parameter)
|
||||
=> await _client.PostToApi<SaveDrinkResponse, SaveDrinkParameter>(ActionUrl(), parameter);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user