Skip to content

Commit

Permalink
make retrieving vcs changes optional #125
Browse files Browse the repository at this point in the history
  • Loading branch information
rekolobov committed Mar 17, 2023
1 parent 3330f0f commit 4448baf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/YouTrackSharp/Issues/IIssuesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ Task<ICollection<Issue>> GetIssues(string filter = null, int? skip = null, int?
/// </summary>
/// <remarks>Uses the REST API <a href="https://www.jetbrains.com/help/youtrack/devportal/resource-api-issues-issueID-activities.html#get_all-ActivityItem-method">Get Changes of an Issue</a>.</remarks>
/// <param name="issueId">Id of the issue to get change history for.</param>
/// <param name="categories">Comma separated category types e.g. IssueResolvedCategory.</param>
/// <param name="vcsHistory">If set to <value>true</value>, vcs historical items will be additionally fetched.</param>
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="Change" /> for the requested issue <paramref name="issueId"/>.</returns>
/// <exception cref="T:System.ArgumentNullException">When the <paramref name="issueId"/> is null or empty.</exception>
/// <exception cref="T:System.Net.HttpRequestException">When the call to the remote YouTrack server instance failed.</exception>
Task<IEnumerable<Change>> GetChangeHistoryForIssue(string issueId, string categories = "AttachmentsCategory,CustomFieldCategory,DescriptionCategory,IssueResolvedCategory,LinksCategory,ProjectCategory,IssueVisibilityCategory,SprintCategory,SummaryCategory,TagsCategory,VcsChangeCategory");
Task<IEnumerable<Change>> GetChangeHistoryForIssue(string issueId, bool vcsHistory = false);

/// <summary>
/// Get comments for a specific issue from the server.
Expand Down
7 changes: 5 additions & 2 deletions src/YouTrackSharp/Issues/IssuesService.History.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ namespace YouTrackSharp.Issues
public partial class IssuesService
{
private const string ACTIVITIES_CATEGORIES =
"AttachmentsCategory,CustomFieldCategory,DescriptionCategory,IssueResolvedCategory,LinksCategory,ProjectCategory,IssueVisibilityCategory,SprintCategory,SummaryCategory,TagsCategory,VcsChangeCategory";
"AttachmentsCategory,CustomFieldCategory,DescriptionCategory,IssueResolvedCategory" +
",LinksCategory,ProjectCategory,IssueVisibilityCategory,SprintCategory,SummaryCategory,TagsCategory";

/// <inheritdoc />
public async Task<IEnumerable<Change>> GetChangeHistoryForIssue(string issueId, string categories = ACTIVITIES_CATEGORIES)
public async Task<IEnumerable<Change>> GetChangeHistoryForIssue(string issueId, bool vcsHistory = false)
{
if (string.IsNullOrEmpty(issueId))
{
throw new ArgumentNullException(nameof(issueId));
}

var categories = ACTIVITIES_CATEGORIES + (vcsHistory ? ",VcsChangeCategory" : "");

var client = await _connection.GetAuthenticatedApiClient();
var response = await client.IssuesActivitiesGetAsync(issueId,
categories, false, null, null, null, Constants.FieldsQueryStrings.Activities);
Expand Down

0 comments on commit 4448baf

Please sign in to comment.