chore: refactoring some code to introduce a common base class for all api classes

This commit is contained in:
Matthias Langhard
2021-05-21 22:13:04 +02:00
parent ac20e2e1d4
commit 89e7ce8449
34 changed files with 721 additions and 551 deletions

41
src/Shared/IBaseApi.cs Normal file
View File

@@ -0,0 +1,41 @@
using System.Threading.Tasks;
namespace Novaloop.PaymoApi.Shared
{
public interface IBaseApi<TReturnType, TCreatType>
{
string ResourceUri { get; set; }
/// <summary>
/// Receive all entities
/// </summary>
Task<TReturnType> GetAll();
/// <summary>
/// Retrieve an existing entity
/// </summary>
/// <param name="entityId">id of the entity</param>
/// <returns></returns>
Task<TReturnType> Get(int entityId);
/// <summary>
/// Create a new entity
/// </summary>
Task<TReturnType> Create( TCreatType entity);
/// <summary>
/// Delete an entity
/// </summary>
/// <param name="entityId">id of the entity</param>
/// <returns></returns>
Task Delete(int entityId);
/// <summary>
/// Update an entity
/// </summary>
/// <param name="entity">entity information to update the entity with</param>
/// <param name="id">id of the entity to update</param>
/// <returns></returns>
Task Update( TCreatType entity, int id);
}
}