/// <summary> /// Initializes a new instance of the <see cref="TvdbPrescanTask"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="httpClient">The HTTP client.</param> /// <param name="config">The config.</param> public TvdbPrescanTask(ILogger logger, IHttpClient httpClient, IServerConfigurationManager config, IFileSystem fileSystem) { _logger = logger; _httpClient = httpClient; _config = config; _fileSystem = fileSystem; }
public MusicBrainzAlbumProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IHttpClient httpClient) : base(logManager, configurationManager) { _httpClient = httpClient; Current = this; }
public FanArtMovieUpdatesPrescanTask(IJsonSerializer jsonSerializer, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient) { _jsonSerializer = jsonSerializer; _config = config; _logger = logger; _httpClient = httpClient; }
public HomeController( IHttpClient client, IEndpointsConfiguration endpointsConfiguration) { _client = client; _endpointsConfiguration = endpointsConfiguration; }
public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, IUserManager userManager, ILogger logger) { _applicationHost = applicationHost; _httpClient = httpClient; _userManager = userManager; _logger = logger; }
public static async Task<MBRegistrationRecord> GetRegistrationStatus(IHttpClient httpClient, IJsonSerializer jsonSerializer, string feature, string mb2Equivalent = null) { var mac = GetMacAddress(); var data = new Dictionary<string, string> {{"feature", feature}, {"key",SupporterKey}, {"mac",mac}, {"mb2equiv",mb2Equivalent}, {"legacykey", LegacyKey} }; var reg = new RegRecord(); try { using (var json = await httpClient.Post(MBValidateUrl, data, CancellationToken.None).ConfigureAwait(false)) { reg = jsonSerializer.DeserializeFromStream<RegRecord>(json); } if (reg.registered) { LicenseFile.AddRegCheck(feature); } } catch (Exception) { //if we have trouble obtaining from web - allow it if we've validated in the past 30 days reg.registered = LicenseFile.LastChecked(feature) > DateTime.UtcNow.AddDays(-30); } return new MBRegistrationRecord {IsRegistered = reg.registered, ExpirationDate = reg.expDate, RegChecked = true}; }
public DefaultRequestExecutor( IHttpClient httpClient, IClientApiKey apiKey, AuthenticationScheme authenticationScheme, ILogger logger, IBackoffStrategy defaultBackoffStrategy, IBackoffStrategy throttlingBackoffStrategy) { if (!apiKey.IsValid()) { throw new ApplicationException("API Key is invalid."); } this.httpClient = httpClient; this.syncHttpClient = httpClient as ISynchronousHttpClient; this.asyncHttpClient = httpClient as IAsynchronousHttpClient; this.apiKey = apiKey; this.authenticationScheme = authenticationScheme; IRequestAuthenticatorFactory requestAuthenticatorFactory = new DefaultRequestAuthenticatorFactory(); this.requestAuthenticator = requestAuthenticatorFactory.Create(authenticationScheme); this.logger = logger; this.defaultBackoffStrategy = defaultBackoffStrategy; this.throttlingBackoffStrategy = throttlingBackoffStrategy; }
public SchedulesDirect(ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IApplicationHost appHost) { _logger = logger; _jsonSerializer = jsonSerializer; _httpClient = httpClient; _appHost = appHost; }
public WebSocketTransport(IHttpClient client) : base(client, "webSockets") { _disconnectToken = CancellationToken.None; ReconnectDelay = TimeSpan.FromSeconds(2); _webSocketHandler = new ClientWebSocketHandler(this); }
public OmdbProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient) { _jsonSerializer = jsonSerializer; _httpClient = httpClient; Current = this; }
// virtual to allow mocking public virtual Task<NegotiationResponse> GetNegotiationResponse(IHttpClient httpClient, IConnection connection, string connectionData) { if (httpClient == null) { throw new ArgumentNullException("httpClient"); } if (connection == null) { throw new ArgumentNullException("connection"); } var negotiateUrl = UrlBuilder.BuildNegotiate(connection, connectionData); httpClient.Initialize(connection); return httpClient.Get(negotiateUrl, connection.PrepareRequest, isLongRunning: false) .Then(response => response.ReadAsString()) .Then(raw => { if (String.IsNullOrEmpty(raw)) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, Resources.Error_ServerNegotiationFailed)); } return JsonConvert.DeserializeObject<NegotiationResponse>(raw); }); }
/// <summary> /// Modifies the request to ensure that the authentication requirements are met. /// </summary> /// <param name="client">Client executing this request</param> /// <param name="request">Request to authenticate</param> /// <param name="credentials">The credentials used for the authentication</param> /// <returns>The task the authentication is performed on</returns> public override async Task PreAuthenticate(IHttpClient client, IHttpRequestMessage request, ICredentials credentials) { // When the authorization failed or when the Authorization header is missing, we're just adding it (again) with the // new AccessToken. var authHeader = $"{_tokenType} {await Client.GetCurrentToken()}"; request.SetAuthorizationHeader(AuthHeader.Www, authHeader); }
/// <summary> /// Initializes a new instance of the <see cref="FanArtAlbumProvider"/> class. /// </summary> /// <param name="httpClient">The HTTP client.</param> /// <param name="logManager">The log manager.</param> /// <param name="configurationManager">The configuration manager.</param> /// <param name="providerManager">The provider manager.</param> public FanArtAlbumProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, IFileSystem fileSystem) : base(logManager, configurationManager) { _providerManager = providerManager; _fileSystem = fileSystem; HttpClient = httpClient; }
/// <summary> /// Initializes a new instance of the <see cref="ReloadLoggerFileTask" /> class. /// </summary> /// <param name="logManager">The logManager.</param> /// <param name="appHost"></param> /// <param name="httpClient"></param> public StatisticsTask(ILogManager logManager, IApplicationHost appHost, INetworkManager networkManager, IHttpClient httpClient) { LogManager = logManager; ApplicationHost = appHost; NetworkManager = networkManager; HttpClient = httpClient; }
public ChannelImageProvider(ILiveTvManager liveTvManager, IHttpClient httpClient, ILogger logger, IApplicationHost appHost) { _liveTvManager = liveTvManager; _httpClient = httpClient; _logger = logger; _appHost = appHost; }
public void Loaded(IConfigLoader configLoader, IChatClient chatClient, IHttpClient httpClient, IFileSystem fileSystem, IRandomiser randomiser) { var config = LoadConfig(configLoader); var mapsClient = new MapsClient(httpClient, config.ApiKey); _mapListener = new MapListener(chatClient, mapsClient); }
/// <summary> /// Downloads a list of trailer info's from the apple url /// </summary> /// <returns>Task{List{TrailerInfo}}.</returns> public static async Task<List<TrailerInfo>> GetTrailerList(IHttpClient httpClient, CancellationToken cancellationToken) { var stream = await httpClient.Get(new HttpRequestOptions { Url = TrailerFeedUrl, CancellationToken = cancellationToken, ResourcePool = Plugin.Instance.AppleTrailers }).ConfigureAwait(false); var list = new List<TrailerInfo>(); using (var reader = XmlReader.Create(stream, new XmlReaderSettings { Async = true })) { await reader.MoveToContentAsync().ConfigureAwait(false); while (await reader.ReadAsync().ConfigureAwait(false)) { cancellationToken.ThrowIfCancellationRequested(); if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "movieinfo": var trailer = FetchTrailerInfo(reader.ReadSubtree()); list.Add(trailer); break; } } } } return list; }
public TvMazeSeasonImageProvider(IJsonSerializer jsonSerializer, IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem) { _config = config; _httpClient = httpClient; _fileSystem = fileSystem; _jsonSerializer = jsonSerializer; }
/// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="jsonSerializer"></param> /// <param name="userManager"></param> /// <param name="userDataManager"> </param> /// <param name="httpClient"></param> /// <param name="appHost"></param> /// <param name="fileSystem"></param> public SyncFromTraktTask(ILogManager logger, IJsonSerializer jsonSerializer, IUserManager userManager, IUserDataManager userDataManager, IHttpClient httpClient, IServerApplicationHost appHost, IFileSystem fileSystem) { _userManager = userManager; _userDataManager = userDataManager; _logger = logger.GetLogger("Trakt"); _traktApi = new TraktApi(jsonSerializer, _logger, httpClient, appHost, userDataManager, fileSystem); }
public FanartAlbumProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem, IJsonSerializer jsonSerializer) { _config = config; _httpClient = httpClient; _fileSystem = fileSystem; _jsonSerializer = jsonSerializer; }
public WebSocketTransport(IHttpClient client) { _client = client; _disconnectToken = CancellationToken.None; ReconnectDelay = TimeSpan.FromSeconds(2); }
public LongPollingTransport(IHttpClient httpClient) : base(httpClient, "longPolling") { ReconnectDelay = TimeSpan.FromSeconds(5); ErrorDelay = TimeSpan.FromSeconds(2); ConnectDelay = TimeSpan.FromSeconds(2); }
/// <summary> /// Initializes a new instance of the <see cref="MovieDbImagesProvider"/> class. /// </summary> /// <param name="logManager">The log manager.</param> /// <param name="configurationManager">The configuration manager.</param> /// <param name="providerManager">The provider manager.</param> /// <param name="jsonSerializer">The json serializer.</param> /// <param name="httpClient">The HTTP client.</param> public MovieDbImagesProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, IJsonSerializer jsonSerializer, IHttpClient httpClient) : base(logManager, configurationManager) { _providerManager = providerManager; _jsonSerializer = jsonSerializer; _httpClient = httpClient; }
public PismoInstaller(IHttpClient httpClient, ILogger logger, IApplicationPaths appPaths, IZipClient zipClient) { _httpClient = httpClient; _logger = logger; _appPaths = appPaths; _zipClient = zipClient; }
public static async Task<MBRegistrationRecord> GetRegistrationStatus(IHttpClient httpClient, IJsonSerializer jsonSerializer, string feature, string mb2Equivalent = null, string version = null) { //check the reg file first to alleviate strain on the MB admin server - must actually check in every 30 days tho var reg = new RegRecord {registered = LicenseFile.LastChecked(feature) > DateTime.UtcNow.AddDays(-30)}; if (!reg.registered) { var mac = _networkManager.GetMacAddress(); var data = new Dictionary<string, string> { { "feature", feature }, { "key", SupporterKey }, { "mac", mac }, { "mb2equiv", mb2Equivalent }, { "legacykey", LegacyKey }, { "ver", version }, { "platform", Environment.OSVersion.VersionString } }; try { using (var json = await httpClient.Post(MBValidateUrl, data, CancellationToken.None).ConfigureAwait(false)) { reg = jsonSerializer.DeserializeFromStream<RegRecord>(json); } if (reg.registered) { LicenseFile.AddRegCheck(feature); } else { LicenseFile.RemoveRegCheck(feature); } } catch (Exception e) { _logger.ErrorException("Error checking registration status of {0}", e, feature); } } return new MBRegistrationRecord {IsRegistered = reg.registered, ExpirationDate = reg.expDate, RegChecked = true}; }
public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IImageProcessor imageProcessor, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ISsdpHandler ssdpHandler) { _config = config; _appHost = appHost; _network = network; _sessionManager = sessionManager; _httpClient = httpClient; _libraryManager = libraryManager; _userManager = userManager; _dlnaManager = dlnaManager; _imageProcessor = imageProcessor; _userDataManager = userDataManager; _localization = localization; _mediaSourceManager = mediaSourceManager; _ssdpHandler = (SsdpHandler)ssdpHandler; _logger = logManager.GetLogger("Dlna"); }
public void FixtureSetup() { HttpClientMock = MockRepository.GenerateMock<IHttpClient>(); Client = new RestBroadcastClient(HttpClientMock); var localTimeZoneRestriction = new CfLocalTimeZoneRestriction(DateTime.Now, DateTime.Now); CfResult[] result = { CfResult.Received }; CfRetryPhoneType[] phoneTypes = { CfRetryPhoneType.FirstNumber }; var broadcastConfigRestryConfig = new CfBroadcastConfigRetryConfig(1000, 2, result, phoneTypes); var expectedTextBroadcastConfig = new CfTextBroadcastConfig(1, DateTime.Now, "fromNumber", localTimeZoneRestriction, broadcastConfigRestryConfig, "Test", CfBigMessageStrategy.DoNotSend); ExpectedBroadcast = new CfBroadcast(1894, "broadcast", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Text, expectedTextBroadcastConfig); var response = string.Format( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<r:ResourceReference xmlns=\"http://api.callfire.com/data\" xmlns:r=\"http://api.callfire.com/resource\">" + "<r:Id>{0}</r:Id>" + "<r:Location>https://www.callfire.com/api/1.1/rest/broadcast/{0}</r:Location>" + "</r:ResourceReference>", ExpectedBroadcast.Id); HttpClientMock .Stub(j => j.Send(Arg<string>.Is.Equal("/broadcast"), Arg<HttpMethod>.Is.Equal(HttpMethod.Post), Arg<BroadcastRequest>.Matches(x => x.Broadcast.id == ExpectedBroadcast.Id && x.Broadcast.Name == ExpectedBroadcast.Name && x.Broadcast.LastModified == ExpectedBroadcast.LastModified && x.Broadcast.Status == BroadcastStatus.RUNNING && x.Broadcast.Type == BroadcastType.TEXT))) .Return(response); }
public static EventSignal<IResponse> PostAsync( IHttpClient client, string url, Action<IRequest> prepareRequest) { return client.PostAsync(url, prepareRequest, null); }
public DataServicePackageRepository(IHttpClient client, PackageDownloader packageDownloader) { if (client == null) { throw new ArgumentNullException("client"); } if (packageDownloader == null) { throw new ArgumentNullException("packageDownloader"); } _httpClient = client; _httpClient.AcceptCompression = true; _packageDownloader = packageDownloader; if (EnvironmentUtility.RunningFromCommandLine || EnvironmentUtility.IsMonoRuntime) { _packageDownloader.SendingRequest += OnPackageDownloaderSendingRequest; } else { // weak event pattern SendingRequestEventManager.AddListener(_packageDownloader, this); } }
/// <summary> /// Initializes a new instance of the <see cref="LastfmArtistProvider"/> class. /// </summary> /// <param name="jsonSerializer">The json serializer.</param> /// <param name="httpClient">The HTTP client.</param> /// <param name="logManager">The log manager.</param> /// <param name="configurationManager">The configuration manager.</param> /// <param name="providerManager">The provider manager.</param> /// <param name="libraryManager">The library manager.</param> public LastfmArtistProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, ILibraryManager libraryManager) : base(jsonSerializer, httpClient, logManager, configurationManager) { _providerManager = providerManager; LibraryManager = libraryManager; LocalMetaFileName = LastfmHelper.LocalArtistMetaFileName; }
public NotifiarrProxy(IHttpClient httpClient, Logger logger) { _httpClient = httpClient; _logger = logger; }
public void SetHttpClient(IHttpClient client) { HttpClient = client; }
public TvdbSeasonImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem) { _config = config; _httpClient = httpClient; _fileSystem = fileSystem; }
protected ApiService(IHttpClient httpClient, IJsonSerializer jsonSerializer, IApplicationHost applicationHost) { _httpClient = httpClient; _jsonSerializer = jsonSerializer; _applicationHost = applicationHost; }
public DataServicePackageRepository(IHttpClient client) : this(client, new PackageDownloader()) { }
public void SetUp() { _httpClient = Substitute.For <IHttpClient>(); _target = new BulkSender(_httpClient); }
public DefaultServerSentEventsTransport(IHttpClient httpClient) : base(httpClient) { }
public SharedHttpStream(MediaSourceInfo mediaSource, TunerHostInfo tunerHostInfo, string originalStreamId, IFileSystem fileSystem, IHttpClient httpClient, ILogger logger, IServerApplicationPaths appPaths, IServerApplicationHost appHost) : base(mediaSource, tunerHostInfo, fileSystem, logger, appPaths) { _httpClient = httpClient; _appHost = appHost; OriginalStreamId = originalStreamId; EnableStreamSharing = true; }
internal EmployeesApi(IConfiguration config, IHttpClient httpClient, IDictionary <string, IAuthManager> authManagers, HttpCallBack httpCallBack = null) : base(config, httpClient, authManagers, httpCallBack) { }
public ServerApiEndpoints(IJsonSerializer jsonSerializer, IHttpClient httpClient) { _jsonSerializer = jsonSerializer; _httpClient = httpClient; }
public void Start(IHttpClient httpClient) { Start(new AutoTransport(httpClient)); }
public AudioDbAlbumImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IJsonSerializer json) { _config = config; _httpClient = httpClient; _json = json; }
static HTTPClient() { SharedClient = new HTTPClient(); }
public BuildPluginService(IHttpClient httpClient, IMemoryCache cache) { _httpClient = httpClient; _cache = cache; }
public ProxyCheck(ISonarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, Logger logger) { _configService = configService; _client = client; _logger = logger; _cloudRequestBuilder = cloudRequestBuilder.Services; }
public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager) { _logger = logger; _sessionManager = sessionManager; _libraryManager = libraryManager; _userManager = userManager; _dlnaManager = dlnaManager; _appHost = appHost; _imageProcessor = imageProcessor; _deviceDiscovery = deviceDiscovery; _httpClient = httpClient; _config = config; _userDataManager = userDataManager; _localization = localization; _mediaSourceManager = mediaSourceManager; }
public GamesDbGameSystemProvider(IApplicationPaths appPaths, IFileSystem fileSystem, IHttpClient httpClient, ILogger logger) { _appPaths = appPaths; _fileSystem = fileSystem; _httpClient = httpClient; _logger = logger; Current = this; }
public TaskRequest(IHttpClient client) : base(client) { }
public HdHomerunDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json) { _deviceDiscovery = deviceDiscovery; _config = config; _logger = logger; _liveTvManager = liveTvManager; _httpClient = httpClient; _json = json; }
public Task Start(IHttpClient httpClient) { // Pick the best transport supported by the client return(Start(new AutoTransport(httpClient))); }
public void Setup() { _client = Substitute.For <IHttpClient>(); _timestamper = new Timestamper(DateTime.UtcNow); _ethPriceService = new EthPriceService(_client, _timestamper, LimboLogs.Instance); }
public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient, IProcessFactory processFactory, IServerConfigurationManager config) { _logger = logger; _fileSystem = fileSystem; _mediaEncoder = mediaEncoder; _appPaths = appPaths; _json = json; _liveTvOptions = liveTvOptions; _httpClient = httpClient; _processFactory = processFactory; _config = config; }
public ProwlProxy(IHttpClient httpClient, Logger logger) { _httpClient = httpClient; _logger = logger; }
internal APIController(IConfiguration config, IHttpClient httpClient, IDictionary<string, IAuthManager> authManagers) : base(config, httpClient, authManagers) { }
public static IRepository Create(string connectionString, IHttpClient httpClient) { return(new Repository(Uri.For(connectionString), httpClient)); }
/// <summary> /// Creates a new connection instance used to make requests of the GitHub API. /// </summary> /// <param name="productInformation"> /// The name (and optionally version) of the product using this library. This is sent to the server as part of /// the user agent for analytics purposes. /// </param> /// <param name="httpClient"> /// The client to use for executing requests /// </param> public Connection(ProductHeaderValue productInformation, IHttpClient httpClient) : this(productInformation, _defaultGitHubApiUrl, _anonymousCredentials, httpClient, new SimpleJsonSerializer()) { }
public Profile(IHttpClient client) { DataContext = new ProfileViewModel(client); InitializeComponent(); }
public Api(IHttpClient client) { _client = client; _client.AddParameterDefault("accountId", Administration.Users.Current.Get().AccountId); }
public PinSharpClient(IHttpClient httpClient) { Api = new PinterestApi(httpClient); }
Repository(Uri uri, IHttpClient httpClient) { this.uri = uri; this.httpClient = httpClient; }