public ApprenticeshipService(
            ILogger <ApprenticeshipService> logger,
            HttpClient httpClient,
            IOptions <ApprenticeshipServiceSettings> settings)
        {
            Throw.IfNull(logger, nameof(logger));
            Throw.IfNull(httpClient, nameof(httpClient));
            Throw.IfNull(settings, nameof(settings));

            _logger     = logger;
            _settings   = settings.Value;
            _httpClient = new HttpClient();
            _httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _settings.ApiKey);



            _getStandardsAndFrameworksUri       = settings.Value.GetStandardsAndFrameworksUri();
            _addApprenticeshipUri               = settings.Value.AddApprenticeshipUri();
            _getApprenticeshipByUKPRNUri        = settings.Value.GetApprenticeshipByUKPRNUri();
            _getApprenticeshipByIdUri           = settings.Value.GetApprenticeshipByIdUri();
            _updateApprenticshipUri             = settings.Value.UpdateAprrenticeshipUri();
            _getStandardByCodeUri               = settings.Value.GetStandardByCodeUri();
            _getFrameworkByCodeUri              = settings.Value.GetFrameworkByCodeUri();
            _deleteBulkUploadApprenticeshipsUri = settings.Value.DeleteBulkUploadApprenticeshipsUri();
            _changeApprenticeshipStatusesForUKPRNSelectionUri =
                settings.Value.ChangeApprenticeshipStatusesForUKPRNSelectionUri();
        }
コード例 #2
0
        public ApprenticeshipService(
            ILogger <ApprenticeshipService> logger,
            HttpClient httpClient,
            IOptions <ApprenticeshipServiceSettings> settings)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            _logger     = logger;
            _settings   = settings.Value;
            _httpClient = httpClient;
            _httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _settings.ApiKey);
            _getStandardsAndFrameworksUri       = settings.Value.GetStandardsAndFrameworksUri();
            _addApprenticeshipUri               = settings.Value.AddApprenticeshipUri();
            _addApprenticeshipsUri              = settings.Value.AddApprenticeshipsUri();
            _getApprenticeshipByUKPRNUri        = settings.Value.GetApprenticeshipByUKPRNUri();
            _getApprenticeshipByIdUri           = settings.Value.GetApprenticeshipByIdUri();
            _updateApprenticshipUri             = settings.Value.UpdateAprrenticeshipUri();
            _getStandardByCodeUri               = settings.Value.GetStandardByCodeUri();
            _getFrameworkByCodeUri              = settings.Value.GetFrameworkByCodeUri();
            _deleteBulkUploadApprenticeshipsUri = settings.Value.DeleteBulkUploadApprenticeshipsUri();
            _changeApprenticeshipStatusesForUKPRNSelectionUri =
                settings.Value.ChangeApprenticeshipStatusesForUKPRNSelectionUri();
            _getApprenticeshipDashboardCountsUri = settings.Value.GetApprenticeshipDashboardCountsUri();
            _getAllDfcReports       = settings.Value.ToGetAllDfcReports();
            _getTotalLiveCoursesUri = settings.Value.ToGetTotalLiveCourses();
        }
コード例 #3
0
 internal static Uri ToDeleteApprenticeshipsByUKPRNUri(this ApprenticeshipServiceSettings extendee)
 {
     return(new Uri(extendee.ApiUrl + "DeleteApprenticeshipsByUKPRN"));
 }
コード例 #4
0
 internal static Uri ToAddApprenticeshipReportUri(this ApprenticeshipServiceSettings extendee)
 {
     return(new Uri(extendee.ApiUrl + "AddApprenticeshipMigrationReport"));
 }
コード例 #5
0
 internal static Uri ToAddApprenticeshipUri(this ApprenticeshipServiceSettings extendee)
 {
     return(new Uri(extendee.ApiUrl + "AddApprenticeship"));
 }