示例#1
0
        /// <summary>
        /// Constructor to initialize a new object of the client.
        /// </summary>
        /// <param name="config">The configuration of the client.</param>
        public OrangebeardClient(OrangebeardConfiguration config)
        {
            ProjectName = config.ProjectName;
            _httpClient = new HttpClientFactory(new Uri(config.Endpoint), config.AccessToken, config.ListenerIdentification).Create();

            ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

            Launch   = new ServiceLaunchResource(_httpClient, ProjectName);
            TestItem = new ServiceTestItemResource(_httpClient, ProjectName);
            LogItem  = new ServiceLogItemResource(_httpClient, ProjectName);
        }
示例#2
0
        /// <summary>
        /// Constructor to initialize a new object of service.
        /// </summary>
        /// <param name="uri">Base URI for REST service.</param>
        /// <param name="projectName">A project to manage.</param>
        /// <param name="token">A token for user. Can be UID given from user's profile page.</param>
        /// <param name="httpClientFactory">Factory object to create an instance of <see cref="HttpClient"/>.</param>
        public Service(Uri uri, string projectName, string token, IHttpClientFactory httpClientFactory = null)
        {
            ProjectName = projectName;

            if (httpClientFactory == null)
            {
                httpClientFactory = new HttpClientFactory(uri, token);
            }

            _httpClient = httpClientFactory.Create();

            Launch     = new ServiceLaunchResource(_httpClient, ProjectName);
            TestItem   = new ServiceTestItemResource(_httpClient, ProjectName);
            LogItem    = new ServiceLogItemResource(_httpClient, ProjectName);
            User       = new ServiceUserResource(_httpClient, ProjectName);
            UserFilter = new ServiceUserFilterResource(_httpClient, ProjectName);
            Project    = new ServiceProjectResource(_httpClient, ProjectName);
        }
示例#3
0
        /// <summary>
        /// Constructor to initialize a new object of service.
        /// </summary>
        /// <param name="uri">Base URI for REST service.</param>
        /// <param name="projectName">A project to manage.</param>
        /// <param name="token">A token for user. Can be UID given from user's profile page.</param>
        /// <param name="httpClientFactory">Factory object to create an instance of <see cref="HttpClient"/>.</param>
        public Service(Uri uri, string projectName, string token, IHttpClientFactory httpClientFactory = null)
        {
            ProjectName = projectName;

            if (httpClientFactory == null)
            {
                httpClientFactory = new HttpClientFactory(uri, token);
            }

            _httpClient = httpClientFactory.Create();

#if NET45
            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
#endif

            Launch     = new ServiceLaunchResource(_httpClient, ProjectName);
            TestItem   = new ServiceTestItemResource(_httpClient, ProjectName);
            LogItem    = new ServiceLogItemResource(_httpClient, ProjectName);
            User       = new ServiceUserResource(_httpClient, ProjectName);
            UserFilter = new ServiceUserFilterResource(_httpClient, ProjectName);
            Project    = new ServiceProjectResource(_httpClient, ProjectName);
        }