2024-07-03 22:18:32 +02:00
|
|
|
|
using WatchIt.Common.Model.Genres;
|
|
|
|
|
|
using WatchIt.Common.Model.Media;
|
2024-09-25 22:11:28 +02:00
|
|
|
|
using WatchIt.Common.Model.Photos;
|
2024-09-28 02:36:53 +02:00
|
|
|
|
using WatchIt.Common.Model.Rating;
|
2024-10-06 23:16:53 +02:00
|
|
|
|
using WatchIt.Common.Model.Roles;
|
2024-07-03 22:18:32 +02:00
|
|
|
|
using WatchIt.Common.Services.HttpClient;
|
|
|
|
|
|
using WatchIt.Website.Services.Utility.Configuration;
|
|
|
|
|
|
using WatchIt.Website.Services.Utility.Configuration.Model;
|
|
|
|
|
|
using WatchIt.Website.Services.WebAPI.Common;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WatchIt.Website.Services.WebAPI.Media;
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
public class MediaWebAPIService : BaseWebAPIService, IMediaWebAPIService
|
2024-07-03 22:18:32 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
#region FIELDS
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IHttpClientService _httpClientService;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region CONSTRUCTORS
|
|
|
|
|
|
|
|
|
|
|
|
public MediaWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_httpClientService = httpClientService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-03 22:18:32 +02:00
|
|
|
|
#region PUBLIC METHODS
|
2024-09-20 23:37:55 +02:00
|
|
|
|
|
|
|
|
|
|
#region Main
|
|
|
|
|
|
|
2024-10-08 02:14:16 +02:00
|
|
|
|
public async Task GetAllMedia(MediaQueryParameters? query = null, Action<IEnumerable<MediaResponse>>? successAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetAllMedia);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
request.Query = query;
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-20 23:37:55 +02:00
|
|
|
|
public async Task GetMedia(long mediaId, Action<MediaResponse>? successAction = null, Action? notFoundAction = null)
|
2024-09-19 13:36:01 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMedia, mediaId);
|
2024-09-19 13:36:01 +02:00
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-19 13:36:01 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-09-20 23:37:55 +02:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Genres
|
|
|
|
|
|
|
|
|
|
|
|
public async Task GetMediaGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null)
|
2024-07-03 22:18:32 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaGenres, mediaId);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-20 23:37:55 +02:00
|
|
|
|
public async Task PostMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
2024-07-03 22:18:32 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.PostMediaGenre, mediaId, genreId);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task DeleteMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.DeleteMediaGenre, mediaId, genreId);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-20 23:37:55 +02:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Rating
|
|
|
|
|
|
|
2024-09-28 02:36:53 +02:00
|
|
|
|
public async Task GetMediaRating(long mediaId, Action<RatingResponse>? successAction = null, Action? notFoundAction = null)
|
2024-09-20 23:37:55 +02:00
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaRating, mediaId);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-20 23:37:55 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task GetMediaRatingByUser(long mediaId, long userId, Action<short>? successAction = null, Action? notFoundAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaRatingByUser, mediaId, userId);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-20 23:37:55 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-28 02:36:53 +02:00
|
|
|
|
public async Task PutMediaRating(long mediaId, RatingRequest body, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null)
|
2024-09-20 23:37:55 +02:00
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.PutMediaRating, mediaId);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
|
|
|
|
|
|
{
|
|
|
|
|
|
Body = body
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-20 23:37:55 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor400BadRequest(badRequestAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task DeleteMediaRating(long mediaId, Action? successAction = null, Action? unauthorizedAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.DeleteMediaRating, mediaId);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-20 23:37:55 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2024-09-21 21:11:21 +02:00
|
|
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-21 21:11:21 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2024-09-20 23:37:55 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
#region Poster
|
2024-09-20 23:37:55 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
public async Task GetMediaPoster(long mediaId, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null)
|
2024-09-19 22:58:39 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaPoster, mediaId);
|
2024-09-19 22:58:39 +02:00
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-19 22:58:39 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
2024-09-25 22:11:28 +02:00
|
|
|
|
.RegisterActionFor400BadRequest(badRequestAction)
|
2024-09-19 22:58:39 +02:00
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
public async Task PutMediaPoster(long mediaId, MediaPosterRequest data, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
2024-07-03 22:18:32 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.PutMediaPoster, mediaId);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
|
|
|
|
|
|
{
|
|
|
|
|
|
Body = data
|
|
|
|
|
|
};
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-07-03 22:18:32 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
2024-09-25 22:11:28 +02:00
|
|
|
|
.RegisterActionFor400BadRequest(badRequestAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
2024-09-19 22:58:39 +02:00
|
|
|
|
.ExecuteAction();
|
2024-07-03 22:18:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
public async Task DeleteMediaPoster(long mediaId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
2024-09-11 15:59:13 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.DeleteMediaPoster, mediaId);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Photos
|
|
|
|
|
|
|
|
|
|
|
|
public async Task GetMediaPhotos(long mediaId, PhotoQueryParameters? query = null, Action<IEnumerable<PhotoResponse>>? successAction = null, Action? notFoundAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaPhotos, mediaId);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
public async Task GetMediaPhotoRandomBackground(long mediaId, Action<PhotoResponse>? successAction = null, Action? notFoundAction = null)
|
2024-09-11 15:59:13 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaPhotoRandomBackground, mediaId);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
2024-09-25 22:11:28 +02:00
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
2024-09-11 15:59:13 +02:00
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
2024-09-25 22:11:28 +02:00
|
|
|
|
|
|
|
|
|
|
public async Task PostMediaPhoto(long mediaId, MediaPhotoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
2024-09-11 15:59:13 +02:00
|
|
|
|
{
|
2024-09-25 22:11:28 +02:00
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.PostMediaPhoto, mediaId);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
|
2024-09-27 01:05:06 +02:00
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url)
|
|
|
|
|
|
{
|
|
|
|
|
|
Body = data
|
|
|
|
|
|
};
|
2024-09-11 15:59:13 +02:00
|
|
|
|
|
2024-09-25 22:11:28 +02:00
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
2024-09-11 15:59:13 +02:00
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
2024-09-25 22:11:28 +02:00
|
|
|
|
.RegisterActionFor400BadRequest(badRequestAction)
|
2024-09-11 15:59:13 +02:00
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
2024-09-25 22:11:28 +02:00
|
|
|
|
.RegisterActionFor404NotFound(notFoundAction)
|
2024-09-11 15:59:13 +02:00
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
2024-09-25 22:11:28 +02:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
2024-09-11 15:59:13 +02:00
|
|
|
|
|
2024-10-06 23:16:53 +02:00
|
|
|
|
#region Roles
|
|
|
|
|
|
|
|
|
|
|
|
public async Task GetMediaAllActorRoles(long id, ActorRoleMediaQueryParameters? query = null, Action<IEnumerable<ActorRoleResponse>>? successAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaAllActorRoles, id);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
request.Query = query;
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-08 19:56:14 +02:00
|
|
|
|
public async Task PostMediaActorRole(long id, ActorRoleMediaRequest data, Action<ActorRoleResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
2024-10-06 23:16:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.PostMediaActorRole, id);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
|
|
|
|
|
request.Body = data;
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor400BadRequest(badRequestAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task GetMediaAllCreatorRoles(long id, CreatorRoleMediaQueryParameters? query = null, Action<IEnumerable<CreatorRoleResponse>>? successAction = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaAllCreatorRoles, id);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
|
|
|
|
request.Query = query;
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-08 19:56:14 +02:00
|
|
|
|
public async Task PostMediaCreatorRole(long id, CreatorRoleMediaRequest data, Action<CreatorRoleResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
2024-10-06 23:16:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
string url = GetUrl(EndpointsConfiguration.Media.PostMediaCreatorRole, id);
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
|
|
|
|
|
request.Body = data;
|
|
|
|
|
|
|
|
|
|
|
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
|
|
|
|
|
response.RegisterActionFor2XXSuccess(successAction)
|
|
|
|
|
|
.RegisterActionFor400BadRequest(badRequestAction)
|
|
|
|
|
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
|
|
|
|
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
|
|
|
|
|
.ExecuteAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-07-03 22:18:32 +02:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region PRIVATE METHODS
|
|
|
|
|
|
|
|
|
|
|
|
protected override string GetServiceBase() => EndpointsConfiguration.Media.Base;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|