Skip to content

Commit 6763f08

Browse files
committed
Add more filter rules
1 parent 21008ff commit 6763f08

13 files changed

+247
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace StreamChat.Core.QueryBuilders.Filters.Polls
2+
{
3+
/// <summary>
4+
/// Filter by Poll AllowAnswers
5+
/// </summary>
6+
public sealed class PollFieldAllowAnswers : BaseFieldToFilter
7+
{
8+
public override string FieldName => "allow_answers";
9+
10+
/// <summary>
11+
/// Return only polls where AllowAnswers is EQUAL to provided value
12+
/// </summary>
13+
public FieldFilterRule EqualsTo(bool allowAnswers) => InternalEqualsTo(allowAnswers);
14+
}
15+
}
16+

Assets/Plugins/StreamChat/Core/QueryBuilders/Filters/Polls/PollFieldAllowAnswers.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace StreamChat.Core.QueryBuilders.Filters.Polls
2+
{
3+
/// <summary>
4+
/// Filter by Poll AllowUserSuggestedOptions
5+
/// </summary>
6+
public sealed class PollFieldAllowUserSuggestedOptions : BaseFieldToFilter
7+
{
8+
public override string FieldName => "allow_user_suggested_options";
9+
10+
/// <summary>
11+
/// Return only polls where AllowUserSuggestedOptions is EQUAL to provided value
12+
/// </summary>
13+
public FieldFilterRule EqualsTo(bool allowUserSuggestedOptions) => InternalEqualsTo(allowUserSuggestedOptions);
14+
}
15+
}
16+

Assets/Plugins/StreamChat/Core/QueryBuilders/Filters/Polls/PollFieldAllowUserSuggestedOptions.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using StreamChat.Core.StatefulModels;
4+
5+
namespace StreamChat.Core.QueryBuilders.Filters.Polls
6+
{
7+
/// <summary>
8+
/// Filter by Poll Creator User Id
9+
/// </summary>
10+
public sealed class PollFieldCreatedById : BaseFieldToFilter
11+
{
12+
public override string FieldName => "created_by_id";
13+
14+
/// <summary>
15+
/// Return only polls where CreatedById is EQUAL to provided user Id
16+
/// </summary>
17+
public FieldFilterRule EqualsTo(string userId) => InternalEqualsTo(userId);
18+
19+
/// <summary>
20+
/// Return only polls where CreatedById is EQUAL to ANY of provided user Ids
21+
/// </summary>
22+
public FieldFilterRule In(IEnumerable<string> userIds) => InternalIn(userIds);
23+
24+
/// <summary>
25+
/// Return only polls where CreatedById is EQUAL to ANY of provided user Ids
26+
/// </summary>
27+
public FieldFilterRule In(params string[] userIds) => InternalIn(userIds);
28+
29+
/// <summary>
30+
/// Return only polls where CreatedById is EQUAL to ANY of the provided users Id
31+
/// </summary>
32+
public FieldFilterRule In(IEnumerable<IStreamUser> users)
33+
=> InternalIn(users.Select(_ => _.Id));
34+
35+
/// <summary>
36+
/// Return only polls where CreatedById is EQUAL to ANY of the provided users Id
37+
/// </summary>
38+
public FieldFilterRule In(params IStreamUser[] users)
39+
=> InternalIn(users.Select(_ => _.Id));
40+
}
41+
}
42+

Assets/Plugins/StreamChat/Core/QueryBuilders/Filters/Polls/PollFieldCreatedById.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
namespace StreamChat.Core.QueryBuilders.Filters.Polls
2+
{
3+
/// <summary>
4+
/// Filter by Poll MaxVotesAllowed
5+
/// </summary>
6+
public sealed class PollFieldMaxVotesAllowed : BaseFieldToFilter
7+
{
8+
public override string FieldName => "max_votes_allowed";
9+
10+
/// <summary>
11+
/// Return only polls where MaxVotesAllowed is EQUAL to provided value
12+
/// </summary>
13+
public FieldFilterRule EqualsTo(int maxVotes) => InternalEqualsTo(maxVotes);
14+
15+
/// <summary>
16+
/// Return only polls where MaxVotesAllowed is NOT EQUAL to provided value
17+
/// </summary>
18+
public FieldFilterRule NotEquals(int maxVotes) => new FieldFilterRule(FieldName, QueryOperatorType.NotEquals, maxVotes);
19+
20+
/// <summary>
21+
/// Return only polls where MaxVotesAllowed is GREATER THAN provided value
22+
/// </summary>
23+
public FieldFilterRule GreaterThan(int maxVotes) => InternalGreaterThan(maxVotes);
24+
25+
/// <summary>
26+
/// Return only polls where MaxVotesAllowed is GREATER THAN OR EQUAL to provided value
27+
/// </summary>
28+
public FieldFilterRule GreaterThanOrEquals(int maxVotes) => InternalGreaterThanOrEquals(maxVotes);
29+
30+
/// <summary>
31+
/// Return only polls where MaxVotesAllowed is LESS THAN provided value
32+
/// </summary>
33+
public FieldFilterRule LessThan(int maxVotes) => InternalLessThan(maxVotes);
34+
35+
/// <summary>
36+
/// Return only polls where MaxVotesAllowed is LESS THAN OR EQUAL to provided value
37+
/// </summary>
38+
public FieldFilterRule LessThanOrEquals(int maxVotes) => InternalLessThanOrEquals(maxVotes);
39+
}
40+
}
41+

Assets/Plugins/StreamChat/Core/QueryBuilders/Filters/Polls/PollFieldMaxVotesAllowed.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/StreamChat/Core/QueryBuilders/Filters/Polls/PollFieldName.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Collections.Generic;
2+
13
namespace StreamChat.Core.QueryBuilders.Filters.Polls
24
{
35
/// <summary>
@@ -12,6 +14,16 @@ public sealed class PollFieldName : BaseFieldToFilter
1214
/// </summary>
1315
public FieldFilterRule EqualsTo(string name) => InternalEqualsTo(name);
1416

17+
/// <summary>
18+
/// Return only polls where Name is EQUAL to ANY of provided names
19+
/// </summary>
20+
public FieldFilterRule In(IEnumerable<string> names) => InternalIn(names);
21+
22+
/// <summary>
23+
/// Return only polls where Name is EQUAL to ANY of provided names
24+
/// </summary>
25+
public FieldFilterRule In(params string[] names) => InternalIn(names);
26+
1527
/// <summary>
1628
/// Return only polls where Name CONTAINS the provided substring (case-insensitive)
1729
/// </summary>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace StreamChat.Core.QueryBuilders.Filters.Polls
2+
{
3+
/// <summary>
4+
/// Filter by Poll VotingVisibility
5+
/// </summary>
6+
public sealed class PollFieldVotingVisibility : BaseFieldToFilter
7+
{
8+
public override string FieldName => "voting_visibility";
9+
10+
/// <summary>
11+
/// Return only polls where VotingVisibility is EQUAL to provided value
12+
/// </summary>
13+
public FieldFilterRule EqualsTo(string votingVisibility) => InternalEqualsTo(votingVisibility);
14+
}
15+
}
16+

0 commit comments

Comments
 (0)