roles rating endpoints added

This commit is contained in:
2024-10-20 00:32:35 +02:00
Unverified
parent 96755a589d
commit ff97793eef
11 changed files with 364 additions and 20 deletions

View File

@@ -6,6 +6,10 @@ public class Roles
public string GetActorRole { get; set; }
public string PutActorRole { get; set; }
public string DeleteActorRole { get; set; }
public string GetActorRoleRating { get; set; }
public string GetActorRoleRatingByUser { get; set; }
public string PutActorRoleRating { get; set; }
public string DeleteActorRoleRating { get; set; }
public string GetAllActorRoleTypes { get; set; }
public string GetActorRoleType { get; set; }
public string PostActorRoleType { get; set; }
@@ -13,6 +17,10 @@ public class Roles
public string GetCreatorRole { get; set; }
public string PutCreatorRole { get; set; }
public string DeleteCreatorRole { get; set; }
public string GetCreatorRoleRating { get; set; }
public string GetCreatorRoleRatingByUser { get; set; }
public string PutCreatorRoleRating { get; set; }
public string DeleteCreatorRoleRating { get; set; }
public string GetAllCreatorRoleTypes { get; set; }
public string GetCreatorRoleType { get; set; }
public string PostCreatorRoleType { get; set; }

View File

@@ -1,3 +1,4 @@
using WatchIt.Common.Model.Rating;
using WatchIt.Common.Model.Roles;
namespace WatchIt.Website.Services.WebAPI.Roles;
@@ -7,6 +8,10 @@ public interface IRolesWebAPIService
Task GetActorRole(Guid id, Action<ActorRoleResponse>? successAction = null, Action? notFoundAction = null);
Task PutActorRole(Guid id, ActorRoleUniversalRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
Task DeleteActorRole(Guid id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
Task GetActorRoleRating(Guid id, Action<RatingResponse>? successAction = null, Action? notFoundAction = null);
Task GetActorRoleRatingByUser(Guid id, long userId, Action<short>? successAction = null, Action? notFoundAction = null);
Task PutActorRoleRating(Guid id, RatingRequest body, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null);
Task DeleteActorRoleRating(Guid id, Action? successAction = null, Action? unauthorizedAction = null);
Task GetAllActorRoleTypes(RoleTypeQueryParameters? query = null, Action<IEnumerable<RoleTypeResponse>>? successAction = null);
Task GetActorRoleType(long typeId, Action<RoleTypeResponse>? successAction = null, Action? notFoundAction = null);
Task PostActorRoleType(RoleTypeRequest data, Action<RoleTypeResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
@@ -15,6 +20,10 @@ public interface IRolesWebAPIService
Task GetCreatorRole(Guid id, Action<CreatorRoleResponse>? successAction = null, Action? notFoundAction = null);
Task PutCreatorRole(Guid id, CreatorRoleUniversalRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
Task DeleteCreatorRole(Guid id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
Task GetCreatorRoleRating(Guid id, Action<RatingResponse>? successAction = null, Action? notFoundAction = null);
Task GetCreatorRoleRatingByUser(Guid id, long userId, Action<short>? successAction = null, Action? notFoundAction = null);
Task PutCreatorRoleRating(Guid id, RatingRequest body, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null);
Task DeleteCreatorRoleRating(Guid id, Action? successAction = null, Action? unauthorizedAction = null);
Task GetAllCreatorRoleTypes(RoleTypeQueryParameters? query = null, Action<IEnumerable<RoleTypeResponse>>? successAction = null);
Task GetCreatorRoleType(long typeId, Action<RoleTypeResponse>? successAction = null, Action? notFoundAction = null);
Task PostCreatorRoleType(RoleTypeRequest data, Action<RoleTypeResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);

View File

@@ -1,4 +1,5 @@
using WatchIt.Common.Model.Roles;
using WatchIt.Common.Model.Rating;
using WatchIt.Common.Model.Roles;
using WatchIt.Common.Services.HttpClient;
using WatchIt.Website.Services.Utility.Configuration;
using WatchIt.Website.Services.WebAPI.Common;
@@ -70,6 +71,59 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService
.RegisterActionFor403Forbidden(forbiddenAction)
.ExecuteAction();
}
public async Task GetActorRoleRating(Guid id, Action<RatingResponse>? successAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.GetActorRoleRating, id);
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task GetActorRoleRatingByUser(Guid id, long userId, Action<short>? successAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.GetActorRoleRatingByUser, id, userId);
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task PutActorRoleRating(Guid id, RatingRequest body, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.PutActorRoleRating, id);
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
{
Body = body
};
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor400BadRequest(badRequestAction)
.RegisterActionFor401Unauthorized(unauthorizedAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task DeleteActorRoleRating(Guid id, Action? successAction = null, Action? unauthorizedAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.DeleteActorRoleRating, id);
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor401Unauthorized(unauthorizedAction)
.ExecuteAction();
}
public async Task GetAllActorRoleTypes(RoleTypeQueryParameters? query = null, Action<IEnumerable<RoleTypeResponse>>? successAction = null)
{
@@ -168,6 +222,59 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService
.ExecuteAction();
}
public async Task GetCreatorRoleRating(Guid id, Action<RatingResponse>? successAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.GetCreatorRoleRating, id);
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task GetCreatorRoleRatingByUser(Guid id, long userId, Action<short>? successAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.GetCreatorRoleRatingByUser, id, userId);
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task PutCreatorRoleRating(Guid id, RatingRequest body, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.PutCreatorRoleRating, id);
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
{
Body = body
};
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor400BadRequest(badRequestAction)
.RegisterActionFor401Unauthorized(unauthorizedAction)
.RegisterActionFor404NotFound(notFoundAction)
.ExecuteAction();
}
public async Task DeleteCreatorRoleRating(Guid id, Action? successAction = null, Action? unauthorizedAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.DeleteCreatorRoleRating, id);
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
HttpResponse response = await _httpClientService.SendRequestAsync(request);
response.RegisterActionFor2XXSuccess(successAction)
.RegisterActionFor401Unauthorized(unauthorizedAction)
.ExecuteAction();
}
public async Task GetAllCreatorRoleTypes(RoleTypeQueryParameters? query = null, Action<IEnumerable<RoleTypeResponse>>? successAction = null)
{
string url = GetUrl(EndpointsConfiguration.Roles.GetAllCreatorRoleTypes);

View File

@@ -108,6 +108,10 @@
"GetActorRole": "/actor/{0}",
"PutActorRole": "/actor/{0}",
"DeleteActorRole": "/actor/{0}",
"GetActorRoleRating": "/actor/{0}/rating",
"GetActorRoleRatingByUser": "/actor/{0}/rating/{1}",
"PutActorRoleRating": "/actor/{0}/rating",
"DeleteActorRoleRating": "/actor/{0}/rating",
"GetAllActorRoleTypes": "/actor/type",
"GetActorRoleType": "/actor/type/{0}",
"PostActorRoleType": "/actor/type",
@@ -115,6 +119,10 @@
"GetCreatorRole": "/creator/{0}",
"PutCreatorRole": "/creator/{0}",
"DeleteCreatorRole": "/creator/{0}",
"GetCreatorRoleRating": "/creator/{0}/rating",
"GetCreatorRoleRatingByUser": "/creator/{0}/rating/{1}",
"PutCreatorRoleRating": "/creator/{0}/rating",
"DeleteCreatorRoleRating": "/creator/{0}/rating",
"GetAllCreatorRoleTypes": "/creator/type",
"GetCreatorRoleType": "/creator/type/{0}",
"PostCreatorRoleType": "/creator/type",