/// <summary> /// Constructor with two injectable fetchers (default & fallback) and /// a baseline resilience policy (timeout & circuit breaker) /// </summary> /// <param name="defaultCommitFetcher"></param> /// <param name="fallbackCommitFetcher"></param> /// <param name="commitViewerLog"></param> /// <param name="baseResiliencePolicy"></param> public CommitsController(ICommitFetcher <CommitDTO> defaultCommitFetcher, ICommitFetcher <CommitDTO> fallbackCommitFetcher, IAsyncPolicy baseResiliencePolicy, ICommitViewerLog commitViewerLog) { this.defaultCommitFetcher = defaultCommitFetcher; this.fallbackCommitFetcher = fallbackCommitFetcher; this.commitViewerLog = commitViewerLog; this.baseResiliencePolicy = baseResiliencePolicy; }
public CommitParser(ICommitIdParser commitIdParser, ICommitAuthorParser commitAuthorParser, ICommitDateParser commitDateParser, ICommitMessageParser commitMessageParser, ICommitViewerLog commitViewerLogger) { this.commitIdParser = commitIdParser; this.commitAuthorParser = commitAuthorParser; this.commitDateParser = commitDateParser; this.commitMessageParser = commitMessageParser; this.logger = commitViewerLogger; }
public GithubCommitFetcher(string gitHubBaseEndpoint, int timeoutMs, ICommitViewerLog logger) { this.githubClient = new HttpClient(); this.githubClient.BaseAddress = new Uri(gitHubBaseEndpoint); this.githubClient.Timeout = TimeSpan.FromMilliseconds(timeoutMs); this.githubClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")); this.githubClient.DefaultRequestHeaders.Add("User-Agent", $"{nameof(GithubCommitFetcher)}App"); this.logger = logger; // to be able to perform https requests ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; ServicePointManager.Expect100Continue = false; }
public GitCLICommitFetcher(ICommitParser commitParser, ICommitViewerLog commitViewerLog) { this.commitParser = commitParser; this.logger = commitViewerLog; }