Client methods for enemies
This commit is contained in:
@@ -25,6 +25,7 @@ namespace EstusShots.Client
|
||||
public Episodes Episodes { get; }
|
||||
public Players Players { get; }
|
||||
public Drinks Drinks { get; }
|
||||
public Enemies Enemies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="EstusShotsClient"/>
|
||||
@@ -39,6 +40,7 @@ namespace EstusShots.Client
|
||||
Episodes = new Episodes(this);
|
||||
Players = new Players(this);
|
||||
Drinks = new Drinks(this);
|
||||
Enemies = new Enemies(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
33
EstusShots.Client/Routes/Enemies.cs
Normal file
33
EstusShots.Client/Routes/Enemies.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
{
|
||||
public class Enemies : IEnemiesController
|
||||
{
|
||||
private readonly EstusShotsClient _client;
|
||||
|
||||
public Enemies(EstusShotsClient client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public async Task<ApiResponse<GetEnemiesResponse>> GetEnemies(GetEnemiesParameter parameter)
|
||||
=> await _client.PostToApi<GetEnemiesResponse, GetEnemiesParameter>(ActionUrl(), parameter);
|
||||
|
||||
public async Task<ApiResponse<GetEnemyResponse>> GetEnemy(GetEnemyParameter parameter)
|
||||
=> await _client.PostToApi<GetEnemyResponse, GetEnemyParameter>(ActionUrl(), parameter);
|
||||
|
||||
public async Task<ApiResponse<SaveEnemyResponse>> SaveEnemy(SaveEnemyParameter parameter)
|
||||
=> await _client.PostToApi<SaveEnemyResponse, SaveEnemyParameter>(ActionUrl(), parameter);
|
||||
|
||||
public async Task<ApiResponse<DeleteEnemyResponse>> DeleteEnemy(DeleteEnemyParameter parameter)
|
||||
=> await _client.PostToApi<DeleteEnemyResponse, DeleteEnemyParameter>(ActionUrl(), parameter);
|
||||
|
||||
private string ActionUrl([CallerMemberName]string caller = "") =>
|
||||
$"{_client.ApiUrl}{GetType().Name}/{caller}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user