Skip to content

Commit

Permalink
Add page query option for search (#408)
Browse files Browse the repository at this point in the history
- To be able to skip pages if desired (load first results, then next pages if triggered/required)
  • Loading branch information
Toa741 authored Mar 15, 2023
1 parent 8170150 commit 61918c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NGitLab/Impl/SearchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ private string CreateGetUrl(string scope, SearchQuery query)
url = Utils.AddParameter(url, "per_page", query.PerPage);
}

if (query.Page.HasValue)
{
url = Utils.AddParameter(url, "page", query.Page);
}

if (query.Confidential.HasValue)
{
url = Utils.AddParameter(url, "confidential", query.Confidential);
Expand Down
2 changes: 2 additions & 0 deletions NGitLab/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3391,6 +3391,8 @@ NGitLab.SearchQuery.Confidential.get -> bool?
NGitLab.SearchQuery.Confidential.set -> void
NGitLab.SearchQuery.OrderBy.get -> string
NGitLab.SearchQuery.OrderBy.set -> void
NGitLab.SearchQuery.Page.get -> int?
NGitLab.SearchQuery.Page.set -> void
NGitLab.SearchQuery.PerPage.get -> int?
NGitLab.SearchQuery.PerPage.set -> void
NGitLab.SearchQuery.Search.get -> string
Expand Down
5 changes: 5 additions & 0 deletions NGitLab/SearchQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ public sealed class SearchQuery
/// 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; }

/// <summary>
/// Specifies the start page.
/// </summary>
public int? Page { get; set; }
}
}

0 comments on commit 61918c2

Please sign in to comment.