public VcsRoot Create(VcsRoot root) { var sb = new StringBuilder(); var rootStr = string.Format( @"<vcs-root id=""{0}"" name=""{1}"" vcsName=""{2}"" status=""{3}"">" ,root.Id,root.Name,root.vcsName,root.Status); sb.Append(rootStr); var projectStr = string.Format( @"<project id=""{0}"" name=""{1}"" />" ,root.Project.Id,root.Project.Name); sb.Append(projectStr); if (root.Properties != null && root.Properties.Property != null && root.Properties.Property.Any()) { sb.Append(string.Format(@"<properties count=""{0}"">", root.Properties.Property.Count)); foreach (var property in root.Properties.Property) { sb.Append(string.Format(@"<property name = ""{0}"" value = ""{1}""/>", property.Name, property.Value)); } sb.Append(@"</properties>"); } sb.Append("</vcs-root>"); var xml = sb.ToString(); return _caller.PostFormat<VcsRoot>(xml, HttpContentTypes.ApplicationXml, HttpContentTypes.ApplicationJson, "/app/rest/vcs-roots/"); }
public void SetVcsRootField(VcsRoot vcsRoot, VcsRootField field, object value) { _caller.PutFormat(value, "/app/rest/vcs-roots/id:{0}/{1}", vcsRoot.Id, ToCamelCase(field.ToString())); }
public VcsRoot AttachVcsRoot(BuildTypeLocator locator, VcsRoot vcsRoot) { var xml = string.Format(@"<vcs-root-entry><vcs-root id=""{0}""/></vcs-root-entry>", vcsRoot.Id); return _caller.PostFormat<VcsRoot>(xml, HttpContentTypes.ApplicationXml, string.Empty, "/app/rest/buildTypes/{0}/vcs-root-entries", locator).Result; }