コード例 #1
0
 public TrolleyCalculatorRepository(IHttpClientDecorator httpClient, ILogger logger, IReadConfig readConfig, ISerializer serializer)
 {
     _client     = httpClient;
     _logger     = logger;
     _readConfig = readConfig;
     _serializer = serializer;
 }
コード例 #2
0
        public GithubMergeTool(
            string username,
            string password,
            bool isDryRun)
        {
            var client = new HttpClient
            {
                BaseAddress = GithubBaseUri
            };

            var authArray = Encoding.ASCII.GetBytes($"{username}:{password}");

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                "Basic",
                Convert.ToBase64String(authArray));
            client.DefaultRequestHeaders.Add(
                "user-agent",
                "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;)");

            // Needed to call the check-runs endpoint
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/vnd.github.antiope-preview+json"));

            if (isDryRun)
            {
                _client = new NoOpHttpClientDecorator(client);
            }
            else
            {
                _client = new HttpClientDecorator(client);
            }
        }
コード例 #3
0
 public ProductRepository(IHttpClientDecorator httpClient, ILogger logger, IReadConfig readConfig, IDeserializer deserializer)
 {
     _client       = httpClient;
     _logger       = logger;
     _readConfig   = readConfig;
     _deserializer = deserializer;
 }