Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DX-391] Add channelFilters to GetPendingEvents query. #22

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Model/FilterType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace Enjin.Platform.Sdk;

/// <summary>
/// Enum values representing the type of filter <see cref="FilterType"/>.
/// </summary>
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
[PublicAPI]
public enum FilterType
{
/// <summary>
/// Indicates an AND filter type.
/// </summary>
[EnumMember(Value = "AND")]
And,

/// <summary>
/// Indicates an OR filter type.
/// </summary>
[EnumMember(Value = "OR")]
Or,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace Enjin.Platform.Sdk;

/// <summary>
/// Models a parameter for parameters that can be used to filter data.
/// </summary>
[JsonConverter(typeof(GraphQlParameterJsonConverter<StringFilterInput>))]
[PublicAPI]
public class StringFilterInput : GraphQlParameter<StringFilterInput>
{
/// <summary>
/// Initializes a new instance of the <see cref="StringFilterInput"/> class.
/// </summary>
public StringFilterInput()
{
}

/// <summary>
/// Sets the filter type.
/// </summary>
/// <param name="type">The filter type.</param>
/// <returns>This parameter for chaining.</returns>
public StringFilterInput SetType(FilterType? type)
{
return SetParameter("type", type);
}

/// <summary>
/// Sets the search term for the filter.
/// </summary>
/// <param name="filter">Set the search term for the filter.</param>
/// <returns>This parameter for chaining.</returns>
public StringFilterInput SetFilter(string filter)
{
return SetParameter("filter", filter);
}
}
12 changes: 12 additions & 0 deletions src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/CoreTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ public static class CoreTypes
/// </summary>
public const string EncodableTokenIdInputArray = "[EncodableTokenIdInput!]!";

// StringFilterInputType

/// <summary>
/// String for <c>StringFilterInput</c> type.
/// </summary>
public const string StringFilter = "StringFilter!";

/// <summary>
/// String for an array of <c>StringFilterInput</c> type.
/// </summary>
public const string StringFilterArray = "[StringFilter!]";

// FreezeStateType

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,14 @@ public GetPendingEvents SetAcknowledgeEvents(bool? acknowledgeEvents)
{
return SetVariable("acknowledgeEvents", CoreTypes.Boolean, acknowledgeEvents);
}

/// <summary>
/// Sets any channel filters.
/// </summary>
/// <param name="filters">Sets any channel filters.</param>
/// <returns>This request for chaining.</returns>
public GetPendingEvents SetChannelFilters(StringFilterInput[]? filters)
{
return SetVariable("channelFilters", CoreTypes.StringFilterArray, filters);
}
}