Example #1
0
        public ThreadServiceBase(IErrorHandlerService errorHandler, IHttpRequestService httpRequest)
        {
            _errorHandler = errorHandler;
            _httpRequest  = httpRequest;

            Accept_Json = new KeyValuePair <string, string>("Accept", "application/json");
        }
Example #2
0
        /// <summary>
        /// Creates a new <see cref="FluentRequest"/> with <paramref name="apiRequestService"/> used for sending the requests
        /// </summary>
        /// <param name="apiRequestService">The request sender</param>
        internal FluentRequest(IHttpRequestService apiRequestService)
        {
            Debug.Assert(apiRequestService != null);

            _apiRequestService = apiRequestService;
            Request            = new HttpRequestMessage();
        }
Example #3
0
 public Job(IHttpRequestService httpRequestService, IDecryptService decryptService, ISecurityService securityService, IFileService fileService)
 {
     _httpRequestService = httpRequestService;
     _decryptService     = decryptService;
     _securityService    = securityService;
     _fileService        = fileService;
 }
 public ExaminationService(IDateTimeService dateTimeService,
                           IWorkingDirectoryProvider workingDirectoryProvider,
                           IExaminationInformation examinationInformation,
                           IMediaService mediaService,
                           IExaminationTimer examinationTimer,
                           IReportService reportService,
                           IAnswersService answersService,
                           IProgressViewModel progressViewModel,
                           IIterationsService iterationsService,
                           IGivenAnswerService givenAnswerService,
                           IHttpRequestService httpRequestService,
                           ILocalAudioMessageService localAudioMessageService,
                           IExaminationRemoteSettings settings)
 {
     this.dateTimeService          = dateTimeService;
     this.workingDirectoryProvider = workingDirectoryProvider;
     this.examinationInformation   = examinationInformation;
     this.examinationTimer         = examinationTimer;
     this.mediaService             = mediaService;
     this.reportService            = reportService;
     this.answersService           = answersService;
     this.iterationsService        = iterationsService;
     this.progressViewModel        = progressViewModel;
     this.givenAnswerService       = givenAnswerService;
     this.httpRequestService       = httpRequestService;
     this.localAudioMessageService = localAudioMessageService;
     this.settings = settings;
     this.examinationTimer.TimeUp += TimeUpHandler;
 }
Example #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            IRTPIServiceFactory rtpiFactory,
            IHttpRequestService httpRequestService
            )
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                loggerFactory.AddDebug(LogLevel.Information);
            }
            else
            {
                loggerFactory.AddDebug(LogLevel.Error);
            }

            app.UseMvc();

            rtpiFactory.RegisterRTPIService("LUAS", new LUASRTPIService(httpRequestService));
            rtpiFactory.RegisterRTPIService("DublinBus", new DublinBusRTPIService(httpRequestService));
        }
Example #6
0
 public GoogleApiProvider(
     IHttpRequestService httpRequestService,
     IApplicationSettingsProvider appSettingsProvider)
 {
     _appSettingsProvider = appSettingsProvider;
     _httpRequestService  = new HttpRequestService();
 }
        public GHServiceBase(IErrorHandlerService errorHandler, IHttpRequestService httpRequest)
        {
            _errorHandler = errorHandler;
            _httpRequest  = httpRequest;

            Accept_V3_Json = new KeyValuePair <string, string>("Accept", "application/vnd.github.v3+json");
        }
Example #8
0
 public WebPermissionService(IPrincipalService principalService, IHttpRequestService httpRequestService, IPermissionItemService permissionService, IWebPermissionServiceAction webPermissionServiceAction, IWebPermissionServiceFile webPermissionServiceFile)
 {
     this.principalService           = principalService;
     this.httpRequestService         = httpRequestService;
     this.permissionService          = permissionService;
     this.webPermissionServiceAction = webPermissionServiceAction;
     this.webPermissionServiceFile   = webPermissionServiceFile;
 }
Example #9
0
 public TlApiController(
     IUserService userService,
     IHttpRequestService httpRequestService
     )
 {
     _userService        = userService;
     _httpRequestService = httpRequestService;
 }
Example #10
0
 public ErfassungsPeriodService(ITransactionScopeProvider transactionScopeProvider,
                                IEntityServiceMappingEngine entityServiceMappingEngine,
                                IHttpRequestService httpRequestService,
                                ISecurityService securityService)
     : base(transactionScopeProvider, entityServiceMappingEngine, securityService)
 {
     cache = httpRequestService;
 }
 public HttpRequestActivityModel()
 {
     DisplayName = "Http Request";
     HttpRequests = new ObservableCollection<File>();
     eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
     httpRequestService = ServiceLocator.Current.GetInstance<IHttpRequestService>();
     fileService = ServiceLocator.Current.GetInstance<IFileService>();
 }
Example #12
0
        public HerokuServiceBase(IErrorHandlerService errorHandler, IHttpRequestService httpRequest)
        {
            _errorHandler = errorHandler;
            _httpRequest  = httpRequest;

            Accept_Json_V3 = new KeyValuePair <string, string>("Accept", "application/vnd.heroku+json; version=3");
            Accept_Json_V4 = new KeyValuePair <string, string>("Accept", "application/vnd.heroku+json; version=4");
        }
Example #13
0
 public WatchListService(
     IHttpRequestService httpRequestService,
     IMarginTradingWatchListRepository watchListRepository,
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService)
 {
     _httpRequestService  = httpRequestService;
     _watchListRepository = watchListRepository;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
 }
Example #14
0
 public IsAliveController(MtFrontendSettings setings,
                          IHttpRequestService httpRequestService,
                          WampSessionsService wampSessionsService,
                          IDateService dateService)
 {
     _setings             = setings;
     _httpRequestService  = httpRequestService;
     _wampSessionsService = wampSessionsService;
     _dateService         = dateService;
 }
Example #15
0
 public ReportService(IDateTimeService dateTimeService,
                      IExaminationInformation examinationInformation,
                      IExaminationRemoteSettings examinationRemoteSettings,
                      IHttpRequestService examinationHttpRequestService)
 {
     this.dateTimeService               = dateTimeService;
     this.examinationInformation        = examinationInformation;
     this.examinationRemoteSettings     = examinationRemoteSettings;
     this.examinationHttpRequestService = examinationHttpRequestService;
 }
Example #16
0
        /// <summary>
        /// Make a request to the specified URL
        /// </summary>
        /// <typeparam name="T">The type of data expected to be returned</typeparam>
        /// <param name="requestService">The request service to use when sending requests</param>
        /// <param name="url">The URL to send the request to</param>
        /// <param name="method">The method to use when sending the request</param>
        /// <param name="body">The body of the content to send</param>
        /// <returns>The response from the server</returns>
        /// <exception cref="ArgumentNullException"><paramref name="requestService"/> or <paramref name="url"/> is <see langword="null"/></exception>
        /// <exception cref="UriFormatException"><paramref name="url"/> is an invalid Uri</exception>
        public static async Task <ApiResponseJson <T> > SendAsync <T>(this IHttpRequestService requestService, string url, string method, object body = null)
        {
            if (requestService is null)
            {
                throw new ArgumentNullException(nameof(requestService));
            }

            return(await PrepareRequest(requestService, url, body)
                   .SendWithJsonResponse <T>(method));
        }
Example #17
0
        public SelectExaminationViewModel(ILog logger,
                                          ISettings settings,
                                          IEventBus eventBus,
                                          IHttpRequestService examinationHttpRequestService) : base(settings)
        {
            this.logger   = logger;
            this.eventBus = eventBus;
            this.examinationHttpRequestService = examinationHttpRequestService;

            DisplayName = Resources.SelectExaminationHeader;
        }
Example #18
0
 public RpcFacade(
     MtFrontendSettings settings,
     IHttpRequestService httpRequestService,
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService,
     IMtDataReaderClientsPair dataReaderClients)
 {
     _settings           = settings;
     _httpRequestService = httpRequestService;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
     _dataReaderClients = dataReaderClients;
 }
Example #19
0
 public JobController(
     IHttpRequestService httpRequestService,
     ILogger <JobController> logger,
     IMapper mapper,
     IMediator mediator
     )
 {
     _httpRequestService = httpRequestService;
     _logger             = logger;
     _mapper             = mapper;
     _mediator           = mediator;
 }
Example #20
0
        public AzureADOAuthClient(IHttpRequestService httpRequestService, IApplicationContext applicationContext)
        {
            _httpRequestService = httpRequestService ?? throw new ArgumentNullException(nameof(httpRequestService));

            var baseRequestBody = new Dictionary <string, string>
            {
                { "client_assertion_type", ClientConstants.ClientAssertionType },
                { "client_assertion", applicationContext.AuthApplicationSecret },
                { "redirect_uri", applicationContext.AuthRedirectUrl }
            }.ToImmutableDictionary();

            _authenticationRequestBody = baseRequestBody.Add("grant_type", ClientConstants.AuthorizationCodeGrantType);
            _refreshTokenRequestBody   = baseRequestBody.Add("grant_type", ClientConstants.RefreshTokenGrantType);
        }
        public LeagueApiConfiguration(
            string key, 
            RegionEnum? defaultRegion, 
            bool waitToAvoidRateLimit, 
            IHttpRequestService httpRequestService = null)
        {
            if (key == null) throw new ArgumentNullException("key");
            if (httpRequestService == null) throw new ArgumentNullException("httpRequestService");

            Key = key;
            DefaultRegion = defaultRegion;
            WaitToAvoidRateLimit = waitToAvoidRateLimit;
            HttpRequestService = httpRequestService;
        }
Example #22
0
        private static FluentRequest PrepareRequest(IHttpRequestService requestService, string url, object body = null)
        {
            Debug.Assert(requestService != null);

            var request = requestService.CreateRequest();

            request.UseUrl(url);

            if (body is null)
            {
                return(request);
            }

            return(request.WithBody().Json(body));
        }
Example #23
0
        /// <summary>
        /// Test
        /// </summary>
        /// <param name="httpRequestService">the httpRequestService</param>
        public void Test(IHttpRequestService httpRequestService)
        {
            foreach (var testCase in this)
            {
                if (testCase.Arranges.Expected != null && testCase.Arranges.Expected.HttpRequest != null)
                {
                    testCase.Arranges.Expected.HttpResponse = httpRequestService.GetResponse(testCase.Arranges.Expected.HttpRequest);
                }

                if (testCase.Arranges.Actual != null)
                {
                    testCase.Arranges.Actual.HttpResponse = httpRequestService.GetResponse(testCase.Arranges.Actual.HttpRequest);
                }

                testCase.Assert(testCase.Arranges.Expected, testCase.Arranges.Actual);
            }
        }
        public LeagueApi(
            string apiKey,
            RegionEnum? region = null,
            bool waitToAvoidRateLimit = false,
            IHttpRequestService httpRequestService = null)
        {
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            httpRequestService = httpRequestService ?? new HttpRequestService();

            LeagueApiConfiguration = new LeagueApiConfiguration(apiKey, region, waitToAvoidRateLimit, httpRequestService);

            Init();
        }
Example #25
0
        public LeagueApi(
            string apiKey,
            RegionEnum?region         = null,
            bool waitToAvoidRateLimit = false,
            IHttpRequestService httpRequestService = null)
        {
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            httpRequestService = httpRequestService ?? new HttpRequestService();

            LeagueApiConfiguration = new LeagueApiConfiguration(apiKey, region, waitToAvoidRateLimit, httpRequestService);

            Init();
        }
Example #26
0
 public OpSkinsApi
 (
     string steamLyticsApiKey,
     IRepoServiceFactory repoServiceFactory,
     ILogServiceFactory logServiceFactory,
     IHttpRequestService httpRequestService,
     ISettingRepoService settingRepoService,
     ISteamMarketScraperService steamMarketScraperService
 )
 {
     _apiKey                    = steamLyticsApiKey;
     _repoServiceFactory        = repoServiceFactory;
     _logger                    = logServiceFactory.CreateLogger <OpSkinsApi>();
     _httpRequestService        = httpRequestService;
     _settingRepoService        = settingRepoService;
     _steamMarketScraperService = steamMarketScraperService;
 }
Example #27
0
        /// <summary>
        /// Test async
        /// </summary>
        /// <param name="httpRequestService">the httpRequestService</param>
        public async Task TestAsync(IHttpRequestService httpRequestService)
        {
            foreach (var testCase in this)
            {
                if (testCase.Arranges.Expected != null && testCase.Arranges.Expected.HttpRequest != null)
                {
                    testCase.Arranges.Expected.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Expected.HttpRequest);
                }

                if (testCase.Arranges.Actual != null)
                {
                    testCase.Arranges.Actual.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Actual.HttpRequest);
                }

                testCase.Assert(testCase.Arranges.Expected, testCase.Arranges.Actual);
            }
        }
Example #28
0
        public OpenTicketsViewModel(IFileSystemService fileSystemService, IHttpRequestService httpRequestService, IBackgroundWorkerService backgroundWorkerService)
        {
            _fileSystemService       = fileSystemService;
            _httpRequestService      = httpRequestService;
            _backgroundWorkerService = backgroundWorkerService;

            DialogTitle = "Open Tickets";
            CanClose    = true;

            OpenGameCommand        = new DelegateCommand <GameTickets>(OpenGame);
            OpenGameTicketsCommand = new DelegateCommand <GameTickets>(OpenGameTickets);
            OpenAchievementCommand = new DelegateCommand <AchievementTickets>(OpenAchievement);

            Progress = new ProgressFieldViewModel {
                Label = String.Empty
            };
            backgroundWorkerService.RunAsync(LoadTickets);
        }
Example #29
0
 public PricingServiceFactory(
     IRepoServiceFactory repoServiceFactory,
     ILogServiceFactory logServiceFactory,
     IHttpRequestService httpRequestService,
     ISettingRepoService settingRepoService,
     IConfiguration configuration,
     ISteamMarketScraperService steamMarketScraperService,
     IJsonRequestParser jsonRequestParser
     )
 {
     _repoServiceFactory        = repoServiceFactory;
     _logServiceFactory         = logServiceFactory;
     _httpRequestService        = httpRequestService;
     _settingRepoService        = settingRepoService;
     _configuration             = configuration;
     _steamMarketScraperService = steamMarketScraperService;
     _jsonRequestParser         = jsonRequestParser;
 }
Example #30
0
        protected void Application_Start()
        {
            var dateTime = DateTime.Now;

            SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
            //Autofac Container Setup
            var container = new ServerContainerSetup().BuildContainer();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            AreaRegistration.RegisterAllAreas();

            //Register Filters
            GlobalFilters.Filters.Add(new AuthorizationFilter(container.Resolve <IPermissionService>(), container.Resolve <ISecurityService>(), container.Resolve <ISessionService>(), container.Resolve <IEreignisLogService>()));
            GlobalFilters.Filters.Add(new AvailabilityFilter(container.Resolve <IAvailabilityService>()));
            GlobalFilters.Filters.Add(new StopwatchAttribute(), 3);
            // to force httpRuntime executionTimeout="10" locally
            //GlobalFilters.Filters.Add(new ExecutionTimeoutToGetAroundBugInMVCAttribute());

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            FluentValidationModelValidatorProvider.Configure(provider => provider.ValidatorFactory = container.Resolve <IValidatorFactory>());
            ValidatorOptions.DisplayNameResolver += DisplayNameResolver;
            ValidatorOptions.ResourceProviderType = typeof(ValidationErrorLocalizationWrapper);

            transactionScopeProvider    = container.Resolve <ITransactionScopeProvider>();
            cookieService               = container.Resolve <ICookieService>();
            serverConfigurationProvider = container.Resolve <IServerConfigurationProvider>();
            ereignisLogService          = container.Resolve <IEreignisLogService>();
            httpRequestService          = container.Resolve <IHttpRequestService>();
            securityService             = container.Resolve <ISecurityService>();

            Loggers.ApplicationLogger.DebugFormat("Initialization duration: {0} second", (DateTime.Now - dateTime).TotalSeconds);

            if (serverConfigurationProvider.EnableMiniProfiler)
            {
                MiniProfiler.Settings.SqlFormatter        = new Web.Infrastructure.MiniProfiler.OracleFormatter();
                MiniProfiler.Settings.IgnoredPaths        = new[] { "/WMS", "/content/", "/scripts/", "/favicon.ico", "/OpenLayers-2.10/" };
                MiniProfiler.Settings.StackMaxLength      = 720;
                MiniProfiler.Settings.MaxJsonResponseSize = 10000000;
            }
        }
Example #31
0
        /// <summary>
        /// Test async
        /// </summary>
        /// <param name="httpRequestService">the httpRequestService</param>
        /// <param name="hookForActual">the hookForActual</param>
        /// <param name="hookForExpected">the hookForExpected</param>
        public async Task TestAsync(IHttpRequestService httpRequestService,
                                    Action <HttpClient> hookForActual   = null,
                                    Action <HttpClient> hookForExpected = null)
        {
            foreach (var testCase in this)
            {
                if (testCase.Arranges.Expected != null && testCase.Arranges.Expected.HttpRequest != null)
                {
                    testCase.Arranges.Expected.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Expected.HttpRequest, hookForExpected);
                }

                if (testCase.Arranges.Actual != null)
                {
                    testCase.Arranges.Actual.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Actual.HttpRequest, hookForActual);
                }

                testCase.Assert(testCase.Arranges.Expected, testCase.Arranges.Actual);
            }
        }
Example #32
0
 public CsgoFastApi
 (
     string steamLyticsApiKey,
     IRepoServiceFactory repoServiceFactory,
     ILogServiceFactory logServiceFactory,
     IHttpRequestService httpRequestService,
     ISettingRepoService settingRepoService,
     ISteamMarketScraperService steamMarketScraperService,
     IJsonRequestParser jsonRequestParser
 )
 {
     _apiKey                    = steamLyticsApiKey;
     _repoServiceFactory        = repoServiceFactory;
     _logger                    = logServiceFactory.CreateLogger <CsgoFastApi>();
     _httpRequestService        = httpRequestService;
     _settingRepoService        = settingRepoService;
     _steamMarketScraperService = steamMarketScraperService;
     _jsonRequestParser         = jsonRequestParser;
 }
        public LeagueApiConfiguration(
            string key,
            RegionEnum?defaultRegion,
            bool waitToAvoidRateLimit,
            IHttpRequestService httpRequestService = null)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (httpRequestService == null)
            {
                throw new ArgumentNullException("httpRequestService");
            }

            Key                  = key;
            DefaultRegion        = defaultRegion;
            WaitToAvoidRateLimit = waitToAvoidRateLimit;
            HttpRequestService   = httpRequestService;
        }
Example #34
0
 public LoginRequestService()
 {
     _httpPostService = new HttpPostService();
     _deserializeJSONService = new DeserializeJSONService();
 }