2024-10-27 22:09:46 +01:00
|
|
|
|
using WatchIt.Website.Services.Configuration;
|
|
|
|
|
|
using WatchIt.Website.Services.Configuration.Model;
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-10-27 22:09:46 +01:00
|
|
|
|
namespace WatchIt.Website.Services.Client;
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
2024-10-27 22:09:46 +01:00
|
|
|
|
public abstract class BaseClientService
|
2024-07-03 22:18:32 +02:00
|
|
|
|
{
|
2024-07-30 16:19:51 +02:00
|
|
|
|
#region SERVICES
|
|
|
|
|
|
|
|
|
|
|
|
protected readonly IConfigurationService _configurationService;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-03 22:18:32 +02:00
|
|
|
|
#region FIELDS
|
|
|
|
|
|
|
2024-07-30 16:19:51 +02:00
|
|
|
|
protected Endpoints EndpointsConfiguration => _configurationService.Data.Endpoints;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region CONSTRUCTORS
|
|
|
|
|
|
|
2024-10-27 22:09:46 +01:00
|
|
|
|
protected BaseClientService(IConfigurationService configurationService)
|
2024-07-30 16:19:51 +02:00
|
|
|
|
{
|
|
|
|
|
|
_configurationService = configurationService;
|
|
|
|
|
|
}
|
2024-07-03 22:18:32 +02:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region PRIVATE METHODS
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract string GetServiceBase();
|
|
|
|
|
|
|
|
|
|
|
|
protected string GetUrl(string suffix) => string.Concat(EndpointsConfiguration.Base, GetServiceBase(), suffix);
|
|
|
|
|
|
|
|
|
|
|
|
protected string GetUrl(string suffix, params object[] format) => string.Concat(EndpointsConfiguration.Base, GetServiceBase(), string.Format(suffix, format));
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|