diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/RolesController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/RolesController.cs index 138a2dc..100b4e0 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/RolesController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/RolesController.cs @@ -37,6 +37,7 @@ public class RolesController : ControllerBase [HttpGet("actor/{id}")] [AllowAnonymous] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetActorRole([FromRoute]Guid id) => await _rolesControllerService.GetActorRole(id); [HttpPut("actor/{id}")] diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs index 3774ebd..fa20a8d 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs @@ -18,4 +18,8 @@ public class Media public string GetMediaPhotos { get; set; } public string GetMediaPhotoRandomBackground { get; set; } public string PostMediaPhoto { get; set; } + public string GetMediaAllActorRoles { get; set; } + public string PostMediaActorRole { get; set; } + public string GetMediaAllCreatorRoles { get; set; } + public string PostMediaCreatorRole { get; set; } } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs index a1c1ab6..4a1381f 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs @@ -12,4 +12,8 @@ public class Persons public string GetPersonPhoto { get; set; } public string PutPersonPhoto { get; set; } public string DeletePersonPhoto { get; set; } + public string GetPersonAllActorRoles { get; set; } + public string PostPersonActorRole { get; set; } + public string GetPersonAllCreatorRoles { get; set; } + public string PostPersonCreatorRole { get; set; } } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs index 154c367..9805329 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs @@ -3,10 +3,16 @@ namespace WatchIt.Website.Services.Utility.Configuration.Model; public class Roles { public string Base { get; set; } + public string GetActorRole { get; set; } + public string PutActorRole { get; set; } + public string DeleteActorRole { get; set; } public string GetAllActorRoleTypes { get; set; } public string GetActorRoleType { get; set; } public string PostActorRoleType { get; set; } public string DeleteActorRoleType { get; set; } + public string GetCreatorRole { get; set; } + public string PutCreatorRole { get; set; } + public string DeleteCreatorRole { get; set; } public string GetAllCreatorRoleTypes { get; set; } public string GetCreatorRoleType { get; set; } public string PostCreatorRoleType { get; set; } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs index 9e5c9b4..86a9dee 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs @@ -2,6 +2,7 @@ using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Rating; +using WatchIt.Common.Model.Roles; namespace WatchIt.Website.Services.WebAPI.Media; @@ -27,4 +28,9 @@ public interface IMediaWebAPIService Task GetMediaPhotos(long mediaId, PhotoQueryParameters? query = null, Action>? successAction = null, Action? notFoundAction = null); Task GetMediaPhotoRandomBackground(long mediaId, Action? successAction = null, Action? notFoundAction = null); Task PostMediaPhoto(long mediaId, MediaPhotoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null); + + Task GetMediaAllActorRoles(long id, ActorRoleMediaQueryParameters? query = null, Action>? successAction = null); + Task PostMediaActorRole(long id, IActorRoleMediaRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + Task GetMediaAllCreatorRoles(long id, CreatorRoleMediaQueryParameters? query = null, Action>? successAction = null); + Task PostMediaCreatorRole(long id, ICreatorRoleMediaRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs index f95ae52..4ec059a 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs @@ -2,6 +2,7 @@ using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Photos; 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.Utility.Configuration.Model; @@ -258,6 +259,64 @@ public class MediaWebAPIService : BaseWebAPIService, IMediaWebAPIService #endregion + #region Roles + + public async Task GetMediaAllActorRoles(long id, ActorRoleMediaQueryParameters? query = null, Action>? 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(); + } + + public async Task PostMediaActorRole(long id, IActorRoleMediaRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + { + 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>? 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(); + } + + public async Task PostMediaCreatorRole(long id, ICreatorRoleMediaRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + { + 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 + #endregion diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs index 3572536..0570417 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs @@ -1,4 +1,5 @@ using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Roles; namespace WatchIt.Website.Services.WebAPI.Persons; @@ -15,4 +16,9 @@ public interface IPersonsWebAPIService Task GetPersonPhoto(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); Task PutPersonPhoto(long id, PersonPhotoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); Task DeletePersonPhoto(long id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + + Task GetPersonAllActorRoles(long id, ActorRolePersonQueryParameters? query = null, Action>? successAction = null); + Task PostPersonActorRole(long id, IActorRolePersonRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + Task GetPersonAllCreatorRoles(long id, CreatorRolePersonQueryParameters? query = null, Action>? successAction = null); + Task PostPersonCreatorRole(long id, ICreatorRolePersonRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs index cd40eff..375b597 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Primitives; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Roles; using WatchIt.Common.Services.HttpClient; using WatchIt.Website.Services.Utility.Configuration; using WatchIt.Website.Services.WebAPI.Common; @@ -185,6 +186,64 @@ public class PersonsWebAPIService : BaseWebAPIService, IPersonsWebAPIService .ExecuteAction(); } + #endregion + + #region Roles + + public async Task GetPersonAllActorRoles(long id, ActorRolePersonQueryParameters? query = null, Action>? successAction = null) + { + string url = GetUrl(EndpointsConfiguration.Persons.GetPersonAllActorRoles, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + request.Query = query; + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .ExecuteAction(); + } + + public async Task PostPersonActorRole(long id, IActorRolePersonRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + { + string url = GetUrl(EndpointsConfiguration.Persons.PostPersonActorRole, 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 GetPersonAllCreatorRoles(long id, CreatorRolePersonQueryParameters? query = null, Action>? successAction = null) + { + string url = GetUrl(EndpointsConfiguration.Persons.GetPersonAllCreatorRoles, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + request.Query = query; + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .ExecuteAction(); + } + + public async Task PostPersonCreatorRole(long id, ICreatorRolePersonRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + { + string url = GetUrl(EndpointsConfiguration.Persons.PostPersonCreatorRole, 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 #endregion diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs index eb2fd41..d88111e 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs @@ -4,12 +4,18 @@ namespace WatchIt.Website.Services.WebAPI.Roles; public interface IRolesWebAPIService { + Task GetActorRole(Guid id, Action? successAction = null, Action? notFoundAction = null); + Task PutActorRole(Guid id, ActorRoleRequest data, Action? successAction = null, Action>? 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 GetAllActorRoleTypes(RoleTypeQueryParameters? query = null, Action>? successAction = null); - Task GetActorRoleType(long id, Action? successAction = null, Action? notFoundAction = null); + Task GetActorRoleType(long typeId, Action? successAction = null, Action? notFoundAction = null); Task PostActorRoleType(RoleTypeRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); - Task DeleteActorRoleType(long id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + Task DeleteActorRoleType(long typeId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + Task GetCreatorRole(Guid id, Action? successAction = null, Action? notFoundAction = null); + Task PutCreatorRole(Guid id, CreatorRoleRequest data, Action? successAction = null, Action>? 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 GetAllCreatorRoleTypes(RoleTypeQueryParameters? query = null, Action>? successAction = null); - Task GetCreatorRoleType(long id, Action? successAction = null, Action? notFoundAction = null); + Task GetCreatorRoleType(long typeId, Action? successAction = null, Action? notFoundAction = null); Task PostCreatorRoleType(RoleTypeRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); - Task DeleteCreatorRoleType(long id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + Task DeleteCreatorRoleType(long typeId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs index f5a4504..839aca8 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs @@ -29,6 +29,47 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService #region PUBLIC METHODS #region Actor + + public async Task GetActorRole(Guid id, Action? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Roles.GetActorRole, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task PutActorRole(Guid id, ActorRoleRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Roles.PutActorRole, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Put, url); + request.Body = data; + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .RegisterActionFor403Forbidden(forbiddenAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task DeleteActorRole(Guid id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + { + string url = GetUrl(EndpointsConfiguration.Roles.DeleteActorRole, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Delete, url); + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .RegisterActionFor403Forbidden(forbiddenAction) + .ExecuteAction(); + } public async Task GetAllActorRoleTypes(RoleTypeQueryParameters? query = null, Action>? successAction = null) { @@ -42,9 +83,9 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService .ExecuteAction(); } - public async Task GetActorRoleType(long id, Action? successAction = null, Action? notFoundAction = null) + public async Task GetActorRoleType(long typeId, Action? successAction = null, Action? notFoundAction = null) { - string url = GetUrl(EndpointsConfiguration.Roles.GetActorRoleType, id); + string url = GetUrl(EndpointsConfiguration.Roles.GetActorRoleType, typeId); HttpRequest request = new HttpRequest(HttpMethodType.Get, url); @@ -69,9 +110,9 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService .ExecuteAction(); } - public async Task DeleteActorRoleType(long id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + public async Task DeleteActorRoleType(long typeId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) { - string url = GetUrl(EndpointsConfiguration.Roles.DeleteActorRoleType, id); + string url = GetUrl(EndpointsConfiguration.Roles.DeleteActorRoleType, typeId); HttpRequest request = new HttpRequest(HttpMethodType.Delete, url); @@ -86,6 +127,47 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService #region Creator + public async Task GetCreatorRole(Guid id, Action? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Roles.GetCreatorRole, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task PutCreatorRole(Guid id, CreatorRoleRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Roles.PutCreatorRole, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Put, url); + request.Body = data; + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .RegisterActionFor403Forbidden(forbiddenAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task DeleteCreatorRole(Guid id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + { + string url = GetUrl(EndpointsConfiguration.Roles.DeleteCreatorRole, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Delete, url); + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .RegisterActionFor403Forbidden(forbiddenAction) + .ExecuteAction(); + } + public async Task GetAllCreatorRoleTypes(RoleTypeQueryParameters? query = null, Action>? successAction = null) { string url = GetUrl(EndpointsConfiguration.Roles.GetAllCreatorRoleTypes); @@ -98,9 +180,9 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService .ExecuteAction(); } - public async Task GetCreatorRoleType(long id, Action? successAction = null, Action? notFoundAction = null) + public async Task GetCreatorRoleType(long typeId, Action? successAction = null, Action? notFoundAction = null) { - string url = GetUrl(EndpointsConfiguration.Roles.GetCreatorRoleType, id); + string url = GetUrl(EndpointsConfiguration.Roles.GetCreatorRoleType, typeId); HttpRequest request = new HttpRequest(HttpMethodType.Get, url); @@ -125,9 +207,9 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService .ExecuteAction(); } - public async Task DeleteCreatorRoleType(long id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) + public async Task DeleteCreatorRoleType(long typeId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null) { - string url = GetUrl(EndpointsConfiguration.Roles.DeleteCreatorRoleType, id); + string url = GetUrl(EndpointsConfiguration.Roles.DeleteCreatorRoleType, typeId); HttpRequest request = new HttpRequest(HttpMethodType.Delete, url); diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index a1d283f..4300ef7 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -51,7 +51,11 @@ "DeleteMediaPoster": "/{0}/poster", "GetMediaPhotos": "/{0}/photos", "GetMediaPhotoRandomBackground": "/{0}/photos/random_background", - "PostMediaPhoto": "/{0}/photos" + "PostMediaPhoto": "/{0}/photos", + "GetMediaAllActorRoles": "/{0}/roles/actor", + "PostMediaActorRole": "/{0}/roles/actor", + "GetMediaAllCreatorRoles": "/{0}/roles/creator", + "PostMediaCreatorRole": "/{0}/roles/creator" }, "Movies": { "Base": "/movies", @@ -88,14 +92,24 @@ "GetPersonsViewRank": "/view", "GetPersonPhoto": "/{0}/photo", "PutPersonPhoto": "/{0}/photo", - "DeletePersonPhoto": "/{0}/photo" + "DeletePersonPhoto": "/{0}/photo", + "GetPersonAllActorRoles": "/{0}/roles/actor", + "PostPersonActorRole": "/{0}/roles/actor", + "GetPersonAllCreatorRoles": "/{0}/roles/creator", + "PostPersonCreatorRole": "/{0}/roles/creator" }, "Roles": { "Base": "/roles", + "GetActorRole": "/actor/{0}", + "PutActorRole": "/actor/{0}", + "DeleteActorRole": "/actor/{0}", "GetAllActorRoleTypes": "/actor/type", "GetActorRoleType": "/actor/type/{0}", "PostActorRoleType": "/actor/type", "DeleteActorRoleType": "/actor/type/{0}", + "GetCreatorRole": "/creator/{0}", + "PutCreatorRole": "/creator/{0}", + "DeleteCreatorRole": "/creator/{0}", "GetAllCreatorRoleTypes": "/creator/type", "GetCreatorRoleType": "/creator/type/{0}", "PostCreatorRoleType": "/creator/type",