public static BatchInfo GetBatchInfo(EyesBaseConfig eyes) { UriBuilder uriBuilder = new UriBuilder(eyes.ServerUrl); uriBuilder.Path = $"api/sessions/batches/{eyes.Batch.Id}/bypointerid"; NameValueCollection query = HttpUtility.ParseQueryString(uriBuilder.Query); query["apiKey"] = eyes.ApiKey; uriBuilder.Query = query.ToString(); HttpRestClient client = new HttpRestClient(uriBuilder.Uri); using (HttpWebResponse batchInfoResponse = client.Get(uriBuilder.ToString())) { BatchInfo batchInfo = batchInfoResponse.DeserializeBody <BatchInfo>(false); return(batchInfo); } }
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); }