private HttpClient AuthorizedHttpClient()
        {
            HttpClient httpClient = _httpService.Client();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"user:{_configuration["VstsApi:PAT"]}")));
            return(httpClient);
        }
        public BuildDefinitions Create(string project)
        {
            HttpClient httpClient = _httpService.Client();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($"user:{_configuration["VstsApi:PAT"]}")));
            string result = httpClient.GetStringAsync($"/{project}/_apis/build/definitions?api-version=4.1").Result;

            return(JsonConvert.DeserializeObject <BuildDefinitions>(result));
        }
        public Projects Create()
        {
            HttpClient httpClient = _httpService.Client();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"user:{_configuration["VstsApi:PAT"]}")));
            string   result   = httpClient.GetStringAsync("_apis/projects?api-version=4.1-preview.1").Result;
            Projects projects = JsonConvert.DeserializeObject <Projects>(result);

            if (projects == null)
            {
                return(new NullProjects());
            }
            return(projects);
        }
        public async Task <Bugs> Create(string projectName)
        {
            HttpClient httpClient = _httpService.Client();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"user:{_configuration["VstsApi:PAT"]}")));

            HttpResponseMessage result = await httpClient.PostAsync($"{projectName}/_apis/wit/wiql?$top=10000&api-version=5.0-preview.2",
                                                                    new StringContent(
                                                                        $"{{ \'Query\': \'SELECT [Id] FROM workitems WHERE [Work Item Type] = \"Bug\" AND ([State] = \"Active\" OR [State] = \"New\") AND [Area Path] UNDER \"{projectName}\"\' }}",
                                                                        Encoding.UTF8,
                                                                        "application/json"), CancellationToken.None);

            Bugs bugs = JsonConvert.DeserializeObject <Bugs>(await result.Content.ReadAsStringAsync());

            if (bugs == null)
            {
                return(new NullBugs());
            }

            return(bugs);
        }