Skip to content

Commit 33d6a8a

Browse files
feature(#17): this commit introduces a fluent class for building query parameters, improving the SDK's usability
1 parent 2c3b708 commit 33d6a8a

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace HttpsRichardy.Federation.Sdk.Filtering;
2+
3+
public sealed class UserGroupsFilters
4+
{
5+
internal int PageNumber { get; private set; } = 1;
6+
internal int PageSize { get; private set; } = 60;
7+
8+
public UserGroupsFilters WithPageNumber(int pageNumber)
9+
{
10+
if (pageNumber > 0)
11+
{
12+
PageNumber = pageNumber;
13+
}
14+
15+
return this;
16+
}
17+
18+
public UserGroupsFilters WithPageSize(int pageSize)
19+
{
20+
if (pageSize > 0)
21+
{
22+
PageSize = pageSize;
23+
}
24+
25+
return this;
26+
}
27+
28+
public static ListUserAssignedGroupsParameters WithoutFilters => new();
29+
public static UserGroupsFilters AsBuilder() => new();
30+
31+
public ListUserAssignedGroupsParameters Build()
32+
{
33+
return new ListUserAssignedGroupsParameters
34+
{
35+
PageNumber = PageNumber,
36+
PageSize = PageSize
37+
};
38+
}
39+
}

0 commit comments

Comments
 (0)