protected Build Get(string endpoint, long id)
 {
     try
     {
         return(ApiClient.Get <BuildModel>($"{endpoint}/id:{id}").Convert());
     }
     catch (HttpException exception)
     {
         if (exception.StatusCode == HttpStatusCode.NotFound)
         {
             return(null);
         }
         throw;
     }
 }
        public bool IsPinned(long buildId)
        {
            var  result = _apiClient.Get <string>(GetUri(buildId));
            bool isPinned;

            if (bool.TryParse(result, out isPinned))
            {
                return(isPinned);
            }
            throw new UnexpectedApiResponseException($"TeamCity API response was \"{result}\", exptected it to be \"true\"/\"false\"");
        }
Ejemplo n.º 3
0
 public IList <string> Get(long buildId)
 {
     try
     {
         var tags = _apiClient.Get <Tags>(GetUri(buildId));
         return(tags?.Tag != null?tags.Tag.Select(t => t.Name).ToList() : new List <string>());
     }
     catch (HttpException exception)
     {
         if (exception.StatusCode == HttpStatusCode.NotFound)
         {
             return(new List <string>());
         }
         throw;
     }
 }
 public string[] GetBranches(BranchPolicyEnum policy)
 {
     return(ApiClient.Get <BranchResponse>($"{GetUri()}branches?locator=policy:{policy.ToString()}").Branch.Select(x => x.Name.ToString()).ToArray());
 }