Skip to content

Commit 8767ded

Browse files
authored
Added opportunity to retrieve merge request discussions and award emojis. (#132)
1 parent 965f031 commit 8767ded

File tree

5 files changed

+80
-1
lines changed

5 files changed

+80
-1
lines changed

src/GitLabApiClient/IssuesClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public async Task<Note> GetNoteAsync(ProjectId projectId, int issueIid, int note
137137
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
138138
/// <param name="issueIid">Iid of the issue.</param>
139139
/// <param name="options">IssueNotes retrieval options.</param>
140-
/// <returns>Issues satisfying options.</returns>
140+
/// <returns>Notes satisfying options.</returns>
141141
public async Task<IList<Note>> GetNotesAsync(ProjectId projectId, int issueIid, Action<IssueNotesQueryOptions> options = null)
142142
{
143143
var queryOptions = new IssueNotesQueryOptions();

src/GitLabApiClient/MergeRequestsClient.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using GitLabApiClient.Internal.Http;
66
using GitLabApiClient.Internal.Paths;
77
using GitLabApiClient.Internal.Queries;
8+
using GitLabApiClient.Models.AwardEmojis.Responses;
9+
using GitLabApiClient.Models.Discussions.Responses;
810
using GitLabApiClient.Models.MergeRequests.Requests;
911
using GitLabApiClient.Models.MergeRequests.Responses;
1012
using GitLabApiClient.Models.Notes.Requests;
@@ -128,5 +130,22 @@ public async Task<IList<Note>> GetNotesAsync(ProjectId projectId, int mergeReque
128130
string url = _projectMergeRequestNotesQueryBuilder.Build($"projects/{projectId}/merge_requests/{mergeRequestIid}/notes", queryOptions);
129131
return await _httpFacade.GetPagedList<Note>(url);
130132
}
133+
134+
/// <summary>
135+
/// Retrieves discussions of a merge request.
136+
/// </summary>
137+
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
138+
/// <param name="mergeRequestIid">Iid of the merge request.</param>
139+
public async Task<IList<Discussion>> GetDiscussionsAsync(ProjectId projectId, int mergeRequestIid) =>
140+
await _httpFacade.GetPagedList<Discussion>($"projects/{projectId}/merge_requests/{mergeRequestIid}/discussions");
141+
142+
/// <summary>
143+
/// Retrieves a list of all award emoji for a specified merge request.
144+
/// </summary>
145+
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
146+
/// <param name="mergeRequestIid">The Internal Merge Request Id.</param>
147+
public async Task<IList<AwardEmoji>> GetAwardEmojisAsync(ProjectId projectId, int mergeRequestIid) =>
148+
await _httpFacade.GetPagedList<AwardEmoji>($"projects/{projectId}/merge_requests/{mergeRequestIid}/award_emoji");
149+
131150
}
132151
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using GitLabApiClient.Models.Users.Responses;
2+
using Newtonsoft.Json;
3+
using System;
4+
5+
namespace GitLabApiClient.Models.AwardEmojis.Responses
6+
{
7+
public sealed class AwardEmoji
8+
{
9+
[JsonProperty("id")]
10+
public int Id { get; set; }
11+
12+
[JsonProperty("name")]
13+
public string Name { get; set; }
14+
15+
[JsonProperty("user")]
16+
public User User { get; set; }
17+
18+
[JsonProperty("created_at")]
19+
public DateTime CreatedAt { get; set; }
20+
21+
[JsonProperty("updated_at")]
22+
public DateTime UpdatedAt { get; set; }
23+
24+
[JsonProperty("awardable_id")]
25+
public int AwardableId { get; set; }
26+
27+
[JsonProperty("awardable_type")]
28+
public AwardableType AwardableType { get; set; }
29+
30+
}
31+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace GitLabApiClient.Models.AwardEmojis.Responses
2+
{
3+
public enum AwardableType
4+
{
5+
Issue,
6+
MergeRequest,
7+
Note,
8+
Snippet,
9+
}
10+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using GitLabApiClient.Models.Notes.Responses;
2+
using Newtonsoft.Json;
3+
using System.Collections.Generic;
4+
5+
namespace GitLabApiClient.Models.Discussions.Responses
6+
{
7+
public sealed class Discussion
8+
{
9+
[JsonProperty("id")]
10+
public string Id { get; set; }
11+
12+
[JsonProperty("individual_note")]
13+
public bool IndividualNote { get; set; }
14+
15+
[JsonProperty("notes")]
16+
public IList<Note> Notes { get; set; } = new List<Note>();
17+
18+
}
19+
}

0 commit comments

Comments
 (0)