-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'nylchr-develop' into develop
- Loading branch information
Showing
19 changed files
with
569 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
public class AgileBoardService | ||
{ | ||
private readonly Connection _connection; | ||
|
||
/// <summary> | ||
/// Creates an instance of the <see cref="AgileBoardService" /> class. | ||
/// </summary> | ||
/// <param name="connection">A <see cref="Connection" /> instance that provides a connection to the remote YouTrack server instance.</param> | ||
public AgileBoardService(Connection connection) | ||
{ | ||
_connection = connection ?? throw new ArgumentNullException(nameof(connection)); | ||
} | ||
|
||
/// <summary> | ||
/// Get a list of agile boards | ||
/// </summary> | ||
/// <remarks>Uses the REST API <a href="https://www.jetbrains.com/help/youtrack/standalone/Get-List-of-Agile-Boards.html">Get the List of Agile Boards</a>.</remarks> | ||
/// <returns>A <see cref="T:System.Collections.Generic.ICollection`1" /> of <see cref="AgileSettings" /> that match the specified parameters.</returns> | ||
/// <exception cref="T:System.Net.HttpRequestException">When the call to the remote YouTrack server instance failed.</exception> | ||
public async Task<ICollection<AgileSettings>> GetAgileBoards() | ||
{ | ||
var client = await _connection.GetAuthenticatedHttpClient(); | ||
var response = await client.GetAsync("rest/admin/agile"); | ||
|
||
if (response.StatusCode == HttpStatusCode.NotFound) | ||
{ | ||
return null; | ||
} | ||
|
||
response.EnsureSuccessStatusCode(); | ||
|
||
return JsonConvert.DeserializeObject<ICollection<AgileSettings>>(await response.Content.ReadAsStringAsync()); | ||
} | ||
|
||
/// <summary> | ||
/// Get the agile board with the specified id. | ||
/// </summary> | ||
/// <remarks>Uses the REST API <a href="https://www.jetbrains.com/help/youtrack/standalone/Get-Agile-Configuration-by-ID.html">Get Agile Configuration by ID</a>.</remarks> | ||
/// <param name="agileBoardId">Id of the agile board containing the sprint.</param> | ||
/// <returns>An <see cref="AgileSettings" /> that match the specified parameter.</returns> | ||
/// <exception cref="T:System.Net.HttpRequestException">When the call to the remote YouTrack server instance failed.</exception> | ||
public async Task<AgileSettings> GetAgileBoard(string agileBoardId) | ||
{ | ||
var client = await _connection.GetAuthenticatedHttpClient(); | ||
var response = await client.GetAsync($"rest/admin/agile/{agileBoardId}"); | ||
|
||
if (response.StatusCode == HttpStatusCode.NotFound) | ||
{ | ||
return null; | ||
} | ||
|
||
response.EnsureSuccessStatusCode(); | ||
|
||
return JsonConvert.DeserializeObject<AgileSettings>(await response.Content.ReadAsStringAsync()); | ||
} | ||
|
||
/// <summary> | ||
/// Get sprint by id | ||
/// </summary> | ||
/// <remarks>Uses the REST API <a href="https://www.jetbrains.com/help/youtrack/standalone/Get-Sprint-by-ID.html">Get Sprint by ID</a>.</remarks> | ||
/// <param name="agileBoardId">Id of the agile board containing the sprint.</param> | ||
/// <param name="sprintId">Id of the sprint.</param> | ||
/// <returns>A <see cref="Sprint" /> that match the specified parameters.</returns> | ||
/// <exception cref="T:System.Net.HttpRequestException">When the call to the remote YouTrack server instance failed.</exception> | ||
public async Task<Sprint> GetSprint(string agileBoardId, string sprintId) | ||
{ | ||
var client = await _connection.GetAuthenticatedHttpClient(); | ||
var response = await client.GetAsync($"rest/admin/agile/{agileBoardId}/sprint/{sprintId}"); | ||
|
||
if (response.StatusCode == HttpStatusCode.NotFound) | ||
{ | ||
return null; | ||
} | ||
|
||
response.EnsureSuccessStatusCode(); | ||
|
||
return JsonConvert.DeserializeObject<Sprint>(await response.Content.ReadAsStringAsync()); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents an agile board | ||
/// </summary> | ||
public class AgileSettings | ||
{ | ||
/// <summary> | ||
/// Creates an instance of the <see cref="AgileSettings" /> class. | ||
/// </summary> | ||
public AgileSettings() | ||
{ | ||
Projects = new List<Project>(); | ||
Sprints = new List<Sprint>(); | ||
} | ||
|
||
/// <summary> | ||
/// List of <see cref="Project"/>s included on the board | ||
/// </summary> | ||
[JsonProperty("projects")] | ||
public ICollection<Project> Projects { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the agile board | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// The internal id used by YouTrack to identify the board | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// The filter query used by the board | ||
/// </summary> | ||
[JsonProperty("query")] | ||
public string Query { get; set; } | ||
|
||
/// <summary> | ||
/// The <see cref="ColumnSettings"/> used by the board | ||
/// </summary> | ||
[JsonProperty("columnSettings")] | ||
public ColumnSettings ColumnSettings { get; set; } | ||
|
||
/// <summary> | ||
/// If time tracking is enabled this property returns the estimation field | ||
/// </summary> | ||
[JsonProperty("timeField")] | ||
public Field TimeField { get; set; } | ||
|
||
/// <summary> | ||
/// If Cards are color coded by a field this field can be found here | ||
/// </summary> | ||
[JsonProperty("colorConfig")] | ||
public ColorConfig ColorConfig { get; set; } | ||
|
||
/// <summary> | ||
/// I have no idea what this field means. | ||
/// </summary> | ||
[JsonProperty("completeBacklogHierarhy")] | ||
public bool CompleteBacklogHierarhy { get; set; } | ||
|
||
/// <summary> | ||
/// The <see cref="SwimlaneSettings"/> of the board | ||
/// </summary> | ||
public SwimlaneSettings SwimlaneSettings { get; set; } | ||
|
||
/// <summary> | ||
/// The saved search that returns the backlog for the board | ||
/// <remarks>See <see cref="Backlog"/> for more info</remarks> | ||
/// </summary> | ||
public Backlog Backlog { get; set; } | ||
|
||
/// <summary> | ||
/// The list of <see cref="Sprint"/>s associated with the board | ||
/// </summary> | ||
public ICollection<Sprint> Sprints { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents the saved search used to get the backlog for the board | ||
/// </summary> | ||
public class Backlog | ||
{ | ||
/// <summary> | ||
/// Gets or sets the query used in the search | ||
/// </summary> | ||
[JsonProperty("value")] | ||
public string Value { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of hte saved search | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the group that can use the saved search | ||
/// </summary> | ||
[JsonProperty("visibleForGroup")] | ||
public string VisibleForGroup { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the group that can update the saved search | ||
/// </summary> | ||
[JsonProperty("updatableByGroup")] | ||
public string UpdatableByGroup { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents the color configuration for an agile board | ||
/// </summary> | ||
public class ColorConfig | ||
{ | ||
/// <summary> | ||
/// Gets or sets the field used to determine how to color code the cards on the board | ||
/// </summary> | ||
[JsonProperty("field")] | ||
public Field Field { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents the column settings of a board | ||
/// </summary> | ||
public class ColumnSettings | ||
{ | ||
/// <summary> | ||
/// Creates an instance of the <see cref="ColumnSettings"/> class | ||
/// </summary> | ||
public ColumnSettings() | ||
{ | ||
VisibleValues = new List<VisibleValue>(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the field used to determine the columns of a board | ||
/// </summary> | ||
[JsonProperty("field")] | ||
public Field Field { get; set; } | ||
|
||
/// <summary> | ||
/// A list of the <see cref="VisibleValues"/> comprising the columns of a board | ||
/// </summary> | ||
[JsonProperty("visibleValues")] | ||
public ICollection<VisibleValue> VisibleValues { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents a YouTrack field used in the context of an agile board | ||
/// </summary> | ||
public class Field | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the field | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the localized name of the field | ||
/// </summary> | ||
[JsonProperty("localizedName")] | ||
public string LocalizedName { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Newtonsoft.Json; | ||
using YouTrackSharp.Projects; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents a project in the context of an agile board. The class only provides an id, see <see cref="ProjectsService"/> | ||
/// for more info on how to access a YouTrack project | ||
/// </summary> | ||
public class Project | ||
{ | ||
/// <summary> | ||
/// Gets or sets the id of a project | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using YouTrackSharp.Json; | ||
|
||
namespace YouTrackSharp.AgileBoards | ||
{ | ||
/// <summary> | ||
/// A class that represents a sprint | ||
/// </summary> | ||
public class Sprint | ||
{ | ||
/// <summary> | ||
/// Gets or sets the id used by YouTrack to identify a sprint | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the sprint. | ||
/// </summary> | ||
[JsonProperty("version")] | ||
public string Version { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the start date of the sprint | ||
/// </summary> | ||
[JsonConverter(typeof(UnixDateTimeOffsetConverter))] | ||
[JsonProperty("start")] | ||
public DateTimeOffset? Start { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the last day of the sprint | ||
/// </summary> | ||
[JsonConverter(typeof(UnixDateTimeOffsetConverter))] | ||
[JsonProperty("finish")] | ||
public DateTimeOffset? Finish { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the is default sprint status | ||
/// </summary> | ||
[JsonProperty("isDefault")] | ||
public bool IsDefault { get; set; } | ||
} | ||
} |
Oops, something went wrong.