diff --git a/.gitignore b/.gitignore index e83ec6cd..79c619d0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ output *.TeamCitySharp.sln.metaproj* *.DotSettings.* nuget -Package \ No newline at end of file +Package +/TeamCitySharp.sln.ide diff --git a/src/TeamCitySharp/ActionTypes/BuildConfigs.cs b/src/TeamCitySharp/ActionTypes/BuildConfigs.cs index cdcd4a0f..0a916848 100644 --- a/src/TeamCitySharp/ActionTypes/BuildConfigs.cs +++ b/src/TeamCitySharp/ActionTypes/BuildConfigs.cs @@ -209,5 +209,11 @@ public BuildConfig BuildType(BuildTypeLocator locator) return build; } + + public string CopyConfiguration(BuildTypeLocator projectLocator, BuildTypeLocator locatorToCopy, string newName) + { + _caller.PostFormat(string.Format("", newName, locatorToCopy), HttpContentTypes.ApplicationXml, "/app/rest/projects/{0}/buildTypes", projectLocator); + return ByConfigurationName(newName).Id; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/ActionTypes/IBuildConfigs.cs b/src/TeamCitySharp/ActionTypes/IBuildConfigs.cs index 2829ec2d..826f25c1 100644 --- a/src/TeamCitySharp/ActionTypes/IBuildConfigs.cs +++ b/src/TeamCitySharp/ActionTypes/IBuildConfigs.cs @@ -33,6 +33,8 @@ public interface IBuildConfigs void DeleteParameter(BuildTypeLocator locator, string parameterName); void DeleteBuildTrigger(BuildTypeLocator locator, string buildTriggerId); + string CopyConfiguration(BuildTypeLocator locatorToCopy, BuildTypeLocator locator, string newName); + /// /// Makes a build type inherit a template. /// diff --git a/src/TeamCitySharp/DomainEntities/AgentRequirements.cs b/src/TeamCitySharp/DomainEntities/AgentRequirements.cs index 6f9afdbe..fa58cf28 100644 --- a/src/TeamCitySharp/DomainEntities/AgentRequirements.cs +++ b/src/TeamCitySharp/DomainEntities/AgentRequirements.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Web; namespace TeamCitySharp.DomainEntities { @@ -9,6 +10,22 @@ public override string ToString() return "agent-requirements"; } - public List AgentRequirement { get; set; } + public List AgentRequirement { get; set; } + + public string GetAsXml() + { + if (AgentRequirement == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var item in AgentRequirement) + { + result += ""; + result += item.Properties.GetAsXml(); + result += ""; + } + result += ""; + return result; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/ArtifactDependencies.cs b/src/TeamCitySharp/DomainEntities/ArtifactDependencies.cs index 82286b91..0e6c5bad 100644 --- a/src/TeamCitySharp/DomainEntities/ArtifactDependencies.cs +++ b/src/TeamCitySharp/DomainEntities/ArtifactDependencies.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Web; namespace TeamCitySharp.DomainEntities { @@ -10,5 +11,21 @@ public override string ToString() } public List ArtifactDependency { get; set; } + + public string GetAsXml() + { + if (ArtifactDependency == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var item in ArtifactDependency) + { + result += ""; + result += item.Properties.GetAsXml(); + result += ""; + } + result += ""; + return result; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/BuildConfig.cs b/src/TeamCitySharp/DomainEntities/BuildConfig.cs index 93034b20..8cbaa486 100644 --- a/src/TeamCitySharp/DomainEntities/BuildConfig.cs +++ b/src/TeamCitySharp/DomainEntities/BuildConfig.cs @@ -1,20 +1,20 @@ -namespace TeamCitySharp.DomainEntities -{ - public class BuildConfig - { - public override string ToString() - { - return Name; - } - - public string Id { get; set; } - public string Name { get; set; } - public string Href { get; set; } - public string ProjectId { get; set; } - public string ProjectName { get; set; } - public string Description { get; set; } - public string WebUrl { get; set; } - +namespace TeamCitySharp.DomainEntities +{ + public class BuildConfig + { + public override string ToString() + { + return Name; + } + + public string Id { get; set; } + public string Name { get; set; } + public string Href { get; set; } + public string ProjectId { get; set; } + public string ProjectName { get; set; } + public string Description { get; set; } + public string WebUrl { get; set; } + public Project Project { get; set; } public Parameters Parameters { get; set; } @@ -23,7 +23,7 @@ public override string ToString() public VcsRootEntries VcsRootEntries { get; set; } public BuildSteps Steps { get; set; } public AgentRequirements AgentRequirements { get; set; } - public BuildTriggers Triggers { get; set; } - public Properties Settings { get; set; } + public BuildTriggers Triggers { get; set; } + public Properties Settings { get; set; } } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/BuildSteps.cs b/src/TeamCitySharp/DomainEntities/BuildSteps.cs index c0c35be1..607c467c 100644 --- a/src/TeamCitySharp/DomainEntities/BuildSteps.cs +++ b/src/TeamCitySharp/DomainEntities/BuildSteps.cs @@ -10,5 +10,21 @@ public override string ToString() } public List Step { get; set; } + + public string GetAsXml() + { + if (Step == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var item in Step) + { + result += ""; + result += item.Properties.GetAsXml(); + result += ""; + } + result += ""; + return result; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/BuildTriggers.cs b/src/TeamCitySharp/DomainEntities/BuildTriggers.cs index 0fbe5cc2..13bcbec0 100644 --- a/src/TeamCitySharp/DomainEntities/BuildTriggers.cs +++ b/src/TeamCitySharp/DomainEntities/BuildTriggers.cs @@ -10,5 +10,21 @@ public override string ToString() } public List Trigger { get; set; } + + public string GetAsXml() + { + if (Trigger == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var item in Trigger) + { + result += ""; + result += item.Properties.GetAsXml(); + result += ""; + } + result += ""; + return result; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/Properties.cs b/src/TeamCitySharp/DomainEntities/Properties.cs index bb13d698..b4245e65 100644 --- a/src/TeamCitySharp/DomainEntities/Properties.cs +++ b/src/TeamCitySharp/DomainEntities/Properties.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Web; namespace TeamCitySharp.DomainEntities { @@ -9,5 +10,19 @@ public override string ToString() return "properties"; } public List Property { get; set; } + + public string GetAsXml() + { + if (Property == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var property in Property) + { + result += ""; + } + result += ""; + return result; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/SnapshotDependencies.cs b/src/TeamCitySharp/DomainEntities/SnapshotDependencies.cs index cd44b4f0..7bd0bb28 100644 --- a/src/TeamCitySharp/DomainEntities/SnapshotDependencies.cs +++ b/src/TeamCitySharp/DomainEntities/SnapshotDependencies.cs @@ -10,5 +10,21 @@ public override string ToString() } public List SnapshotDependency { get; set; } - } + + public string GetAsXml() + { + if (SnapshotDependency == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var item in SnapshotDependency) + { + result += ""; + result += item.Properties.GetAsXml(); + result += ""; + } + result += ""; + return result; + } + } } \ No newline at end of file diff --git a/src/TeamCitySharp/DomainEntities/VcsRootEntries.cs b/src/TeamCitySharp/DomainEntities/VcsRootEntries.cs index 6a18f42b..ecba7234 100644 --- a/src/TeamCitySharp/DomainEntities/VcsRootEntries.cs +++ b/src/TeamCitySharp/DomainEntities/VcsRootEntries.cs @@ -10,5 +10,22 @@ public override string ToString() } public List VcsRootEntry { get; set; } + + public string GetAsXml() + { + if (VcsRootEntry == null) + return ""; + string result = string.Empty; + result += ""; + foreach (var item in VcsRootEntry) + { + result += ""; + result += ""; + result += ""; + result += ""; + } + result += ""; + return result; + } } } \ No newline at end of file diff --git a/src/TeamCitySharp/ITeamCityClient.cs b/src/TeamCitySharp/ITeamCityClient.cs index f63f97d3..f8c6f3c8 100644 --- a/src/TeamCitySharp/ITeamCityClient.cs +++ b/src/TeamCitySharp/ITeamCityClient.cs @@ -1,4 +1,4 @@ -using TeamCitySharp.ActionTypes; +using TeamCitySharp.ActionTypes; namespace TeamCitySharp { @@ -7,7 +7,7 @@ public interface ITeamCityClient void Connect(string userName, string password); void ConnectAsGuest(); bool Authenticate(); - + IBuilds Builds { get; } IBuildConfigs BuildConfigs { get; } IProjects Projects { get; } @@ -16,6 +16,6 @@ public interface ITeamCityClient IAgents Agents { get; } IVcsRoots VcsRoots { get; } IChanges Changes { get; } - IBuildArtifacts Artifacts { get; } + IBuildArtifacts Artifacts { get; } } } \ No newline at end of file diff --git a/src/TeamCitySharp/TeamCityClient.cs b/src/TeamCitySharp/TeamCityClient.cs index eeb9bb82..a3520274 100644 --- a/src/TeamCitySharp/TeamCityClient.cs +++ b/src/TeamCitySharp/TeamCityClient.cs @@ -1,4 +1,4 @@ -using TeamCitySharp.ActionTypes; +using TeamCitySharp.ActionTypes; using TeamCitySharp.Connection; namespace TeamCitySharp @@ -37,8 +37,8 @@ public bool Authenticate() } public IBuilds Builds - { - get { return _builds ?? (_builds = new Builds(_caller)); } + { + get { return _builds ?? (_builds = new Builds(_caller)); } } public IBuildConfigs BuildConfigs @@ -55,8 +55,8 @@ public IServerInformation ServerInformation { get { return _serverInformation ?? (_serverInformation = new ServerInformation(_caller)); } } - - public IUsers Users + + public IUsers Users { get { return _users ?? (_users = new Users(_caller)); } } @@ -72,8 +72,8 @@ public IVcsRoots VcsRoots } public IChanges Changes - { - get { return _changes ?? (_changes = new Changes(_caller)); } + { + get { return _changes ?? (_changes = new Changes(_caller)); } } public IBuildArtifacts Artifacts @@ -81,4 +81,4 @@ public IBuildArtifacts Artifacts get { return _artifacts ?? (_artifacts = new BuildArtifacts(_caller)); } } } -} +} diff --git a/src/TeamCitySharp/TeamCitySharp.csproj b/src/TeamCitySharp/TeamCitySharp.csproj index 2e7df5aa..1a71295e 100644 --- a/src/TeamCitySharp/TeamCitySharp.csproj +++ b/src/TeamCitySharp/TeamCitySharp.csproj @@ -42,6 +42,7 @@ +