Created
May 3, 2024 15:10
-
-
Save andrebaltieri/7b9acaf3b03c556adf4e7b96c1fac6e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Refit; | |
using FinaFlow.Core.Entities; | |
namespace FinaFlow.Services; | |
public interface ICategoryService | |
{ | |
[Post("/v1/categories/")] | |
Task CreateAsync([Body] Category category); | |
[Put("/v1/categories/{id}")] | |
Task UpdateAsync(uint id, [Body] Category category); | |
[Get("/v1/categories")] | |
Task<List<Category>> GetAsync(); | |
[Get("/v1/categories/{id}")] | |
Task<Category> GetByIdAsync(uint id); | |
[Delete("/v1/categories/{id}")] | |
Task DeleteAsync(uint id); | |
} | |
public class HomePage | |
{ | |
private readonly ICategoryService _api; | |
public HomePage(IHttpClientFactory httpClientFactory) | |
{ | |
var httpClient = httpClientFactory.CreateClient(Configuration.HttpClientName); | |
_api = RestService.For<ICategoryService>(httpClient); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment