public RedmineManager(string host, string apiKey, MimeType mimeType = MimeType.Xml,
                              IRedmineHttpSettings httpClientHandler        = null)
        {
            host.EnsureValidHost();
            Host     = host;
            MimeType = mimeType;

            var clientHandler = httpClientHandler != null
                ? httpClientHandler.Build()
                : DefaultRedmineHttpSettings.Create().Build();

            RedmineHttp = new RedmineHttpClient(clientHandler);

            ApiKey = apiKey;
        }
示例#2
0
        public RedmineManager(string host, IAuthentication authentication, MimeType mimeType = MimeType.Xml,
                              IRedmineHttpSettings httpClientHandler = null)
        {
            host.EnsureValidHost();

            if (authentication == null)
            {
                throw new ArgumentNullException(nameof(authentication));
            }

            Host     = host;
            MimeType = mimeType;

            var auth = authentication.Build();

            var clientHandler = httpClientHandler != null
                ? httpClientHandler.SetAuthentication(auth).Build()
                : DefaultRedmineHttpSettings.Create().SetAuthentication(auth).Build();

            RedmineHttp = new RedmineHttpClient(clientHandler);
        }