public RequestPollingTaskListener(HttpRestClient restClient, Uri pollingUrl,
                                   TaskListener <HttpResponseMessage> listener, Logger logger = null)
 {
     restClient_ = restClient;
     logger_     = logger;
     pollingUrl_ = pollingUrl;
     listener_   = listener;
     OnComplete  = OnComplete_;
     OnFail      = OnFail_;
 }
 private HttpRestClient(HttpRestClient other)
 {
     ServerUrl           = other.ServerUrl;
     json_               = other.json_;
     AgentId             = other.AgentId;
     ConnectionLimit     = other.ConnectionLimit;
     Timeout             = other.Timeout;
     Proxy               = other.Proxy;
     Headers             = new NameValueCollection(other.Headers);
     authUser_           = other.authUser_;
     authPassword_       = other.authPassword_;
     Retry               = other.Retry;
     FormatRequestUri    = other.FormatRequestUri;
     ConfigureRequest    = other.ConfigureRequest;
     RequestCompleted    = other.RequestCompleted;
     RequestFailed       = other.RequestFailed;
     WebRequestCreator   = other.WebRequestCreator;
     httpClientProvider_ = other.httpClientProvider_;
     httpClient_         = other.httpClient_;
 }
        public static SessionResults GetSessionResults(Eyes eyes, TestResults testResults)
        {
            string apiSessionUrl = testResults?.ApiUrls?.Session;

            if (string.IsNullOrWhiteSpace(apiSessionUrl))
            {
                return(null);
            }
            UriBuilder          uriBuilder = new UriBuilder(apiSessionUrl);
            NameValueCollection query      = HttpUtility.ParseQueryString(uriBuilder.Query);

            query["format"]      = "json";
            query["AccessToken"] = testResults.SecretToken;
            query["apiKey"]      = eyes.ApiKey;
            uriBuilder.Query     = query.ToString();

            HttpRestClient  client         = new HttpRestClient(uriBuilder.Uri);
            HttpWebResponse metaResults    = client.Get(uriBuilder.ToString());
            SessionResults  sessionResults = metaResults.DeserializeBody <SessionResults>(false);

            return(sessionResults);
        }