chore: refactoring some code to introduce a common base class for all api classes
This commit is contained in:
41
src/Shared/IBaseApi.cs
Normal file
41
src/Shared/IBaseApi.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user