movie page added

This commit is contained in:
2024-09-19 13:36:01 +02:00
Unverified
parent a65cbea929
commit 3f926d63d6
19 changed files with 228 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
public class Media
{
public string Base { get; set; }
public string Get { get; set; }
public string GetGenres { get; set; }
public string PostGenre { get; set; }
public string DeleteGenre { get; set; }

View File

@@ -5,6 +5,7 @@ namespace WatchIt.Website.Services.WebAPI.Media;
public interface IMediaWebAPIService
{
Task Get(long mediaId, Action<MediaResponse> successAction = null, Action? notFoundAction = null);
Task GetGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null);
Task PostGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
Task GetPhotoRandomBackground(Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null);

View File

@@ -10,6 +10,18 @@ namespace WatchIt.Website.Services.WebAPI.Media;
public class MediaWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : BaseWebAPIService(configurationService), IMediaWebAPIService
{
#region PUBLIC METHODS
public async Task Get(long mediaId, Action<MediaResponse> successAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Media.Get, mediaId);
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
HttpResponse response = await httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task GetGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null)
{