forked from stack72/TeamCitySharp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of Issue 18: Call to get the last change details for a…
… build type - this has got the format of last change and all changes
- Loading branch information
Showing
8 changed files
with
250 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
320 changes: 160 additions & 160 deletions
320
src/TeamCitySharp/BuildLocator.cs → src/TeamCitySharp/Locators/BuildLocator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,161 +1,161 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace TeamCitySharp | ||
{ | ||
public enum BuildStatus | ||
{ | ||
SUCCESS, | ||
FAILURE, | ||
ERROR | ||
} | ||
public class BuildLocator | ||
{ | ||
public static BuildLocator WithId(long id) | ||
{ | ||
return new BuildLocator {Id = id}; | ||
} | ||
|
||
public static BuildLocator WithNumber(string number) | ||
{ | ||
return new BuildLocator {Number = number}; | ||
} | ||
|
||
public static BuildLocator RunningBuilds() | ||
{ | ||
return new BuildLocator {Running = true}; | ||
} | ||
|
||
public static BuildLocator WithDimensions(BuildTypeLocator buildType = null, | ||
UserLocator user = null, | ||
string agentName = null, | ||
BuildStatus? status = null, | ||
bool? personal = null, | ||
bool? canceled = null, | ||
bool? running = null, | ||
bool? pinned = null, | ||
int? maxResults = null, | ||
int? startIndex = null, | ||
BuildLocator sinceBuild = null, | ||
DateTime? sinceDate = null, | ||
string[] tags = null | ||
) | ||
{ | ||
return new BuildLocator | ||
{ | ||
BuildType = buildType, | ||
User = user, | ||
AgentName = agentName, | ||
Status = status, | ||
Personal = personal, | ||
Canceled = canceled, | ||
Running = running, | ||
Pinned = pinned, | ||
MaxResults = maxResults, | ||
StartIndex = startIndex, | ||
SinceBuild = sinceBuild, | ||
SinceDate = sinceDate, | ||
Tags = tags | ||
}; | ||
} | ||
|
||
public long? Id { get; private set; } | ||
public string Number { get; private set; } | ||
public string[] Tags { get; private set; } | ||
public BuildTypeLocator BuildType { get; private set; } | ||
public UserLocator User { get; private set; } | ||
public string AgentName { get; private set; } | ||
public BuildStatus? Status { get; private set; } | ||
public BuildLocator SinceBuild { get; private set; } | ||
public bool? Personal { get; private set; } | ||
public bool? Canceled { get; private set; } | ||
public bool? Running { get; private set; } | ||
public bool? Pinned { get; private set; } | ||
public int? MaxResults { get; private set; } | ||
public int? StartIndex { get; private set; } | ||
public DateTime? SinceDate { get; private set; } | ||
|
||
public override string ToString() | ||
{ | ||
if (Id != null) | ||
{ | ||
return "id:" + Id; | ||
} | ||
|
||
if (Number != null) | ||
{ | ||
return "number:" + Number; | ||
} | ||
|
||
var locatorFields = new List<string>(); | ||
|
||
if (BuildType != null) | ||
{ | ||
locatorFields.Add("buildType:(" + BuildType + ")"); | ||
} | ||
|
||
if (User != null) | ||
{ | ||
locatorFields.Add("user:(" + User + ")"); | ||
} | ||
|
||
if (Tags != null) | ||
{ | ||
locatorFields.Add("tags:(" + string.Join(",", Tags) + ")"); | ||
} | ||
|
||
if (SinceBuild != null) | ||
{ | ||
locatorFields.Add("sinceBuild:(" + SinceBuild + ")"); | ||
} | ||
|
||
if(!string.IsNullOrEmpty(AgentName)) | ||
{ | ||
locatorFields.Add("agentName:" + AgentName); | ||
} | ||
|
||
if(Status.HasValue) | ||
{ | ||
locatorFields.Add("status:" + Status.Value.ToString()); | ||
} | ||
|
||
if(Personal.HasValue) | ||
{ | ||
locatorFields.Add("personal:" + Personal.Value.ToString()); | ||
} | ||
|
||
if(Canceled.HasValue) | ||
{ | ||
locatorFields.Add("canceled:" + Canceled.Value.ToString()); | ||
} | ||
|
||
if(Running.HasValue) | ||
{ | ||
locatorFields.Add("running:" + Running.Value.ToString()); | ||
} | ||
|
||
if(Pinned.HasValue) | ||
{ | ||
locatorFields.Add("pinned:" + Pinned.Value.ToString()); | ||
} | ||
|
||
if(MaxResults.HasValue) | ||
{ | ||
locatorFields.Add("count:" + MaxResults.Value.ToString()); | ||
} | ||
|
||
if(StartIndex.HasValue) | ||
{ | ||
locatorFields.Add("start:" + StartIndex.Value.ToString()); | ||
} | ||
|
||
if (SinceDate.HasValue) | ||
{ | ||
locatorFields.Add("sinceDate:" + | ||
SinceDate.Value.ToString("yyyyMMdd'T'HHmmsszzzz").Replace(":", "").Replace("+", "-")); | ||
} | ||
|
||
return string.Join(",", locatorFields.ToArray()); | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace TeamCitySharp.Locators | ||
{ | ||
public enum BuildStatus | ||
{ | ||
SUCCESS, | ||
FAILURE, | ||
ERROR | ||
} | ||
public class BuildLocator | ||
{ | ||
public static BuildLocator WithId(long id) | ||
{ | ||
return new BuildLocator {Id = id}; | ||
} | ||
|
||
public static BuildLocator WithNumber(string number) | ||
{ | ||
return new BuildLocator {Number = number}; | ||
} | ||
|
||
public static BuildLocator RunningBuilds() | ||
{ | ||
return new BuildLocator {Running = true}; | ||
} | ||
|
||
public static BuildLocator WithDimensions(BuildTypeLocator buildType = null, | ||
UserLocator user = null, | ||
string agentName = null, | ||
BuildStatus? status = null, | ||
bool? personal = null, | ||
bool? canceled = null, | ||
bool? running = null, | ||
bool? pinned = null, | ||
int? maxResults = null, | ||
int? startIndex = null, | ||
BuildLocator sinceBuild = null, | ||
DateTime? sinceDate = null, | ||
string[] tags = null | ||
) | ||
{ | ||
return new BuildLocator | ||
{ | ||
BuildType = buildType, | ||
User = user, | ||
AgentName = agentName, | ||
Status = status, | ||
Personal = personal, | ||
Canceled = canceled, | ||
Running = running, | ||
Pinned = pinned, | ||
MaxResults = maxResults, | ||
StartIndex = startIndex, | ||
SinceBuild = sinceBuild, | ||
SinceDate = sinceDate, | ||
Tags = tags | ||
}; | ||
} | ||
|
||
public long? Id { get; private set; } | ||
public string Number { get; private set; } | ||
public string[] Tags { get; private set; } | ||
public BuildTypeLocator BuildType { get; private set; } | ||
public UserLocator User { get; private set; } | ||
public string AgentName { get; private set; } | ||
public BuildStatus? Status { get; private set; } | ||
public BuildLocator SinceBuild { get; private set; } | ||
public bool? Personal { get; private set; } | ||
public bool? Canceled { get; private set; } | ||
public bool? Running { get; private set; } | ||
public bool? Pinned { get; private set; } | ||
public int? MaxResults { get; private set; } | ||
public int? StartIndex { get; private set; } | ||
public DateTime? SinceDate { get; private set; } | ||
|
||
public override string ToString() | ||
{ | ||
if (Id != null) | ||
{ | ||
return "id:" + Id; | ||
} | ||
|
||
if (Number != null) | ||
{ | ||
return "number:" + Number; | ||
} | ||
|
||
var locatorFields = new List<string>(); | ||
|
||
if (BuildType != null) | ||
{ | ||
locatorFields.Add("buildType:(" + BuildType + ")"); | ||
} | ||
|
||
if (User != null) | ||
{ | ||
locatorFields.Add("user:(" + User + ")"); | ||
} | ||
|
||
if (Tags != null) | ||
{ | ||
locatorFields.Add("tags:(" + string.Join(",", Tags) + ")"); | ||
} | ||
|
||
if (SinceBuild != null) | ||
{ | ||
locatorFields.Add("sinceBuild:(" + SinceBuild + ")"); | ||
} | ||
|
||
if(!string.IsNullOrEmpty(AgentName)) | ||
{ | ||
locatorFields.Add("agentName:" + AgentName); | ||
} | ||
|
||
if(Status.HasValue) | ||
{ | ||
locatorFields.Add("status:" + Status.Value.ToString()); | ||
} | ||
|
||
if(Personal.HasValue) | ||
{ | ||
locatorFields.Add("personal:" + Personal.Value.ToString()); | ||
} | ||
|
||
if(Canceled.HasValue) | ||
{ | ||
locatorFields.Add("canceled:" + Canceled.Value.ToString()); | ||
} | ||
|
||
if(Running.HasValue) | ||
{ | ||
locatorFields.Add("running:" + Running.Value.ToString()); | ||
} | ||
|
||
if(Pinned.HasValue) | ||
{ | ||
locatorFields.Add("pinned:" + Pinned.Value.ToString()); | ||
} | ||
|
||
if(MaxResults.HasValue) | ||
{ | ||
locatorFields.Add("count:" + MaxResults.Value.ToString()); | ||
} | ||
|
||
if(StartIndex.HasValue) | ||
{ | ||
locatorFields.Add("start:" + StartIndex.Value.ToString()); | ||
} | ||
|
||
if (SinceDate.HasValue) | ||
{ | ||
locatorFields.Add("sinceDate:" + | ||
SinceDate.Value.ToString("yyyyMMdd'T'HHmmsszzzz").Replace(":", "").Replace("+", "-")); | ||
} | ||
|
||
return string.Join(",", locatorFields.ToArray()); | ||
} | ||
} | ||
} |
Oops, something went wrong.