media view count incrementation endpoint added, media page loading optimized, media view count incrementation on media page added

This commit is contained in:
2024-09-21 21:11:21 +02:00
Unverified
parent 6e2a38fb7c
commit 40fdc3f345
10 changed files with 112 additions and 44 deletions

View File

@@ -11,6 +11,7 @@ public class Media
public string GetMediaRatingByUser { get; set; }
public string PutMediaRating { get; set; }
public string DeleteMediaRating { get; set; }
public string PostMediaView { get; set; }
public string GetPhotoMediaRandomBackground { get; set; }
public string GetPoster { get; set; }
public string PutPoster { get; set; }

View File

@@ -14,6 +14,8 @@ public interface IMediaWebAPIService
Task GetMediaRatingByUser(long mediaId, long userId, Action<short>? successAction = null, Action? notFoundAction = null);
Task PutMediaRating(long mediaId, MediaRatingRequest body, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null);
Task DeleteMediaRating(long mediaId, Action? successAction = null, Action? unauthorizedAction = null);
Task PostMediaView(long mediaId, Action? successAction = null, Action? notFoundAction = null);
Task GetPhotoMediaRandomBackground(long mediaId, Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null);
Task GetPhotoRandomBackground(Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null);

View File

@@ -113,6 +113,22 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
}
#endregion
#region View count
public async Task PostMediaView(long mediaId, Action? successAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Media.PostMediaView, mediaId);
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
HttpResponse response = await httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
#endregion