public HeaderViewModel( IMonitorStreamsModel monitorStreamsModel, StreamLauncher streamLauncher, FilterModel filterModelModel, IApiClientFactory apiClientFactory, ApiClientsQualitiesViewModel apiClientsQualitiesViewModel, IWindowManager windowManager) { if (monitorStreamsModel == null) { throw new ArgumentNullException(nameof(monitorStreamsModel)); } if (streamLauncher == null) { throw new ArgumentNullException(nameof(streamLauncher)); } if (filterModelModel == null) { throw new ArgumentNullException(nameof(filterModelModel)); } if (apiClientFactory == null) { throw new ArgumentNullException(nameof(apiClientFactory)); } FilterModel = filterModelModel; MonitorStreamsModel = monitorStreamsModel; this.streamLauncher = streamLauncher; this.apiClientFactory = apiClientFactory; this.windowManager = windowManager; this.apiClientsQualitiesViewModel = apiClientsQualitiesViewModel ?? throw new ArgumentNullException(nameof(apiClientsQualitiesViewModel)); }
static PullRequestService CreateTarget( IGitClient gitClient = null, IGitService gitService = null, IVSGitExt gitExt = null, IApiClientFactory apiClientFactory = null, IGraphQLClientFactory graphqlFactory = null, IOperatingSystem os = null, IUsageTracker usageTracker = null) { gitClient = gitClient ?? Substitute.For <IGitClient>(); gitService = gitService ?? Substitute.For <IGitService>(); gitExt = gitExt ?? Substitute.For <IVSGitExt>(); apiClientFactory = apiClientFactory ?? Substitute.For <IApiClientFactory>(); graphqlFactory = graphqlFactory ?? Substitute.For <IGraphQLClientFactory>(); os = os ?? Substitute.For <IOperatingSystem>(); usageTracker = usageTracker ?? Substitute.For <IUsageTracker>(); return(new PullRequestService( gitClient, gitService, gitExt, apiClientFactory, graphqlFactory, os, usageTracker)); }
public ApiClientsQualitiesViewModel( ISettingsHandler settingsHandler, IApiClientFactory apiClientFactory) { this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory)); this.settingsHandler = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler)); }
public MonitoredStreamsFileHandler( IApiClientFactory apiClientFactory, ITwitchTvHelixReadonlyClient twitchTvHelixReadonlyClient) { this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory)); this.twitchTvHelixReadonlyClient = twitchTvHelixReadonlyClient ?? throw new ArgumentNullException(nameof(twitchTvHelixReadonlyClient)); }
public HeaderViewModel( IMonitorStreamsModel monitorStreamsModel, StreamLauncher streamLauncher, FilterModel filterModelModel, IApiClientFactory apiClientFactory) { if (monitorStreamsModel == null) { throw new ArgumentNullException(nameof(monitorStreamsModel)); } if (streamLauncher == null) { throw new ArgumentNullException(nameof(streamLauncher)); } if (filterModelModel == null) { throw new ArgumentNullException(nameof(filterModelModel)); } if (apiClientFactory == null) { throw new ArgumentNullException(nameof(apiClientFactory)); } FilterModel = filterModelModel; MonitorStreamsModel = monitorStreamsModel; this.streamLauncher = streamLauncher; this.apiClientFactory = apiClientFactory; }
/// <summary> /// Initializes a new instance of the <see cref="IssueishService"/> class. /// </summary> /// <param name="apiClientFactory">The API client factory.</param> /// <param name="graphqlFactory">The GraphQL client factory.</param> public IssueishService( IApiClientFactory apiClientFactory, IGraphQLClientFactory graphqlFactory) { this.apiClientFactory = apiClientFactory; this.graphqlFactory = graphqlFactory; }
public ShowPullRequestCommentsCommand( IApiClientFactory apiClientFactory, IPullRequestSessionManager sessionManager) : base(CommandSet, CommandId) { this.apiClientFactory = apiClientFactory; this.sessionManager = sessionManager; }
public DocumentParsing(IApiClientFactory factory) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } client = factory.GetClient(); }
public MonitoredStreamsFileHandler(IApiClientFactory apiClientFactory) { if (apiClientFactory == null) { throw new ArgumentNullException(nameof(apiClientFactory)); } this.apiClientFactory = apiClientFactory; }
public void SetupBeforeEachTest() { this.neoApi = A.Fake <ISendRestCommandsToNeo>(); A.CallTo(() => this.neoApi.SendCommandAsync(A <string> ._)).Returns(JsonConvert.DeserializeObject <NeoResponse>(Response)); this.apiClientFactory = A.Fake <IApiClientFactory>(); A.CallTo(() => this.apiClientFactory.GetApiClient()).Returns(this.neoApi); this.neoClient = new NeoClient(this.apiClientFactory); }
public static Task <Count> GetCountOfRecords(IApiClientFactory factory, Settings settings, Endpoint?endpoint) { return(endpoint != null ? endpoint.GetCountOfRecords(factory, settings) : Task.FromResult(new Count { Kind = Count.Types.Kind.Unavailable })); }
public AnomalyAnalysis(IApiClientFactory factory) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } client = factory.GetClient(); }
public Plugin(HttpClient client = null) { _apiClientFactory = new ApiClientFactory(client ?? new HttpClient()); _server = new ServerStatus { Connected = false, WriteConfigured = false }; }
public InlineCommentPeekService( IApiClientFactory apiClientFactory, IOutliningManagerService outliningManager, IPeekBroker peekBroker) { this.apiClientFactory = apiClientFactory; this.outliningService = outliningManager; this.peekBroker = peekBroker; }
public ModelServiceFactory( IApiClientFactory apiClientFactory, IHostCacheFactory hostCacheFactory, IAvatarProvider avatarProvider) { this.apiClientFactory = apiClientFactory; this.hostCacheFactory = hostCacheFactory; this.avatarProvider = avatarProvider; }
public MonitorStreamsModel( IMonitoredStreamsFileHandler fileHandler, ISettingsHandler settingsHandler, IApiClientFactory apiClientFactory) { this.fileHandler = fileHandler ?? throw new ArgumentNullException(nameof(fileHandler)); this.settingsHandler = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler)); this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory)); }
public AgentStatusService(IApiClientFactory apiClientFactory, IConfigurationService configurationService, ILogger logger) { _registrationQueueApiClient = apiClientFactory.GetClientFor <AgentRegistrationQueue>(); _agentApiClient = apiClientFactory.GetClientFor <Models.Resources.V1.Agent>(); _agentConfiguration = configurationService.Get <AgentConfiguration>(); _logger = logger; }
public SentimentTracking(IApiClientFactory factory) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } client = factory.GetClient(); client = client ?? throw new ArgumentNullException(nameof(client)); }
private static async Task <Schema> GetSchemaForEndpoint(IApiClientFactory factory, Settings settings, Schema schema, Endpoint?endpoint) { if (endpoint == null) { return(schema); } if (endpoint.ShouldGetStaticSchema) { return(await endpoint.GetStaticSchemaAsync(factory, settings, schema)); } var recordsListRaw = await endpoint.ReadRecordsAsync(factory, settings, null, null, true).Take(100).ToListAsync(); var recordsList = recordsListRaw .Select(r => JsonConvert.DeserializeObject <Dictionary <string, object> >(r.DataJson)) .ToList(); var types = GetPropertyTypesFromRecords(recordsList); var record = recordsList.FirstOrDefault(); var properties = new List <Property>(); if (record != null) { foreach (var recordKey in record.Keys) { var property = new Property { Id = recordKey, Name = recordKey, Type = types[recordKey], IsKey = endpoint.PropertyKeys.Contains(recordKey), IsCreateCounter = false, IsUpdateCounter = false, TypeAtSource = await endpoint.IsCustomProperty(factory, settings, recordKey) ? Constants.CustomProperty : "", IsNullable = true }; properties.Add(property); } } schema.Properties.Clear(); schema.Properties.AddRange(properties); if (schema.Properties.Count == 0) { schema.Description = Constants.EmptySchemaDescription; } return(schema); }
public SearchService(IApiClientFactory apiClientFactory, IConfiguration configuration, ILogger <SearchService> logger) { _searchEngines = new List <SearchEngineConfiguration>(); _apiClientFactory = apiClientFactory; _logger = logger; var section = configuration.GetSection("SearchEngines"); section.Bind(_searchEngines); }
public VodListViewModel( StreamLauncher streamLauncher, IMonitorStreamsModel monitorStreamsModel, IApiClientFactory apiClientFactory) { this.streamLauncher = streamLauncher ?? throw new ArgumentNullException(nameof(streamLauncher)); this.monitorStreamsModel = monitorStreamsModel ?? throw new ArgumentNullException(nameof(monitorStreamsModel)); this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory)); ItemsPerPage = VOD_TILES_PER_PAGE; }
public ModelServiceFactory( IApiClientFactory apiClientFactory, IHostCacheFactory hostCacheFactory, IAvatarProvider avatarProvider, [Import(AllowDefault = true)] JoinableTaskContext joinableTaskContext) { this.apiClientFactory = apiClientFactory; this.hostCacheFactory = hostCacheFactory; this.avatarProvider = avatarProvider; JoinableTaskContext = joinableTaskContext ?? ThreadHelper.JoinableTaskContext; }
public virtual async Task <Count> GetCountOfRecords(IApiClientFactory factory, Settings settings) { var response = await factory.CreateApiClient(settings).GetAsync($"{BasePath.TrimEnd('/')}/{AllPath.TrimStart('/')}"); var recordsList = JsonConvert.DeserializeObject <DataWrapper>(await response.Content.ReadAsStringAsync()); return(new Count { Kind = Count.Types.Kind.Exact, Value = (int)recordsList.TotalRecords }); }
public PopularLivestreamWatcher( ISettingsHandler settingsHandler, INotificationHandler notificationHandler, INavigationService navigationService, IApiClientFactory apiClientFactory) { if (navigationService == null) { throw new ArgumentNullException(nameof(navigationService)); } this.settingsHandler = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler)); this.notificationHandler = notificationHandler ?? throw new ArgumentNullException(nameof(notificationHandler)); this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory)); clickAction = (model, notification) => { var livestream = model.Livestreams.FirstOrDefault(x => Equals(x, notification.LivestreamModel)); if (livestream != null) { model.SelectedLivestream = livestream; } else { navigationService.NavigateTo <TopStreamsViewModel>(viewModel => viewModel.SelectedApiClient = notification.LivestreamModel.ApiClient); } }; settingsHandler.Settings.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(Settings.MinimumEventViewers)) { MinimumEventViewers = settingsHandler.Settings.MinimumEventViewers; if (MinimumEventViewers == 0) { watching = false; } else if (stoppedWatching) { StartWatching(); } } else if (args.PropertyName == nameof(Settings.DisableNotifications)) { if (!settingsHandler.Settings.DisableNotifications) { // clear the existing cache so the next poll can re-add notifications notifiedEvents.ToList().ForEach(x => notifiedEvents.Remove(x.Key)); } } }; }
public InlineCommentPeekableItemSourceProvider( IApiClientFactory apiClientFactory, IInlineCommentPeekService peekService, IPullRequestSessionManager sessionManager, INextInlineCommentCommand nextCommentCommand, IPreviousInlineCommentCommand previousCommentCommand) { this.apiClientFactory = apiClientFactory; this.peekService = peekService; this.sessionManager = sessionManager; this.nextCommentCommand = nextCommentCommand; this.previousCommentCommand = previousCommentCommand; }
public void Setup() { var mockApiUrl = new Uri("http://test.test.com"); var mockHttp = new MockHttpMessageHandler(); mockHttp .When(mockApiUrl.ToString()) .Respond("application/json", _samplie_json); _apiClientFactory = MockHelper.CreateClient(mockHttp); _service = new CoffeeShopService(_apiClientFactory); }
public static async IAsyncEnumerable <Schema> GetRefreshSchemas(IApiClientFactory factory, Settings settings, RepeatedField <Schema> refreshSchemas, int sampleSize = 5) { foreach (var schema in refreshSchemas) { var endpoint = EndpointHelper.GetEndpointForSchema(schema); var refreshSchema = await GetSchemaForEndpoint(factory, settings, schema, endpoint); // get sample and count yield return(await AddSampleAndCount(factory, settings, refreshSchema, sampleSize, endpoint)); } }
public RepositoryHostFactory( IApiClientFactory apiClientFactory, IHostCacheFactory hostCacheFactory, ILoginCache loginCache, IAvatarProvider avatarProvider, ITwoFactorChallengeHandler twoFactorChallengeHandler) { this.apiClientFactory = apiClientFactory; this.hostCacheFactory = hostCacheFactory; this.loginCache = loginCache; this.avatarProvider = avatarProvider; this.twoFactorChallengeHandler = twoFactorChallengeHandler; }
public RepositoryHostFactory( IApiClientFactory apiClientFactory, IHostCacheFactory hostCacheFactory, ILoginCache loginCache, IAvatarProvider avatarProvider, ITwoFactorChallengeHandler twoFactorChallengeHandler) { this.apiClientFactory = apiClientFactory; this.hostCacheFactory = hostCacheFactory; this.loginCache = loginCache; this.avatarProvider = avatarProvider; this.twoFactorChallengeHandler = twoFactorChallengeHandler; }
public static async IAsyncEnumerable <Record> ReadRecordsAsync(IApiClientFactory factory, Settings settings, Schema schema, DateTime?lastReadTime = null, TaskCompletionSource <DateTime>?tcs = null) { var endpoint = EndpointHelper.GetEndpointForSchema(schema); var records = endpoint?.ReadRecordsAsync(factory, settings, lastReadTime, tcs); if (records != null) { await foreach (var record in records) { yield return(record); } } }
public ConnectionManager( IVSGitServices vsGitServices, IConnectionCache cache, ILoginManager loginManager, IApiClientFactory apiClientFactory) { this.vsGitServices = vsGitServices; this.cache = cache; this.loginManager = loginManager; this.apiClientFactory = apiClientFactory; Connections = new ObservableCollection <IConnection>(); LoadConnectionsFromCache().Forget(); }