Skip to content

Commit

Permalink
Add per_page support for EventQuery (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Toa741 authored Jun 28, 2021
1 parent 5d317be commit 457a07a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NGitLab/Impl/EventClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ public EventClient(API api, string baseUrl)

public IEnumerable<Event> Get(EventQuery query)
{
string url = _baseUrl;
var url = _baseUrl;

url = Utils.AddParameter(url, "action", query.Action);
url = Utils.AddParameter(url, "target_type", query.Type);
url = Utils.AddParameter(url, "before", query.Before?.Date);
url = Utils.AddParameter(url, "after", query.After?.Date);
url = Utils.AddParameter(url, "scope", query.Scope);
url = Utils.AddParameter(url, "sort", query.Sort);
url = Utils.AddParameter(url, "per_page", query.PerPage);

return _api.Get().GetAll<Event>(url);
}
Expand Down
5 changes: 5 additions & 0 deletions NGitLab/Models/EventQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ public class EventQuery
/// Sort events in asc or desc order by created_at. Default is desc
/// </summary>
public string Sort { get; set; }

/// <summary>
/// Specifies how many records per page (GitLab supports a maximum of 100 items per page and defaults to 20).
/// </summary>
public int? PerPage { get; set; }
}
}

0 comments on commit 457a07a

Please sign in to comment.