Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Models/GetOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Stream.Rest;
using System.Collections.Generic;

namespace Stream.Models
{
Expand All @@ -17,6 +18,8 @@ public class GetOptions
private string _feed_slug = null;
private string _user_id = null;

private IDictionary<string, string> _custom = null;

public GetOptions WithOffset(int offset)
{
_offset = offset;
Expand Down Expand Up @@ -77,6 +80,17 @@ public GetOptions WithUserId(string userId)
return this;
}

public GetOptions WithCustom(string key, string value)
{
if (_custom == null)
{
_custom = new Dictionary<string, string>();
}

_custom.Add(key, value);
return this;
}

internal void Apply(RestRequest request)
{
request.AddQueryParameter("offset", _offset.ToString());
Expand All @@ -97,6 +111,12 @@ internal void Apply(RestRequest request)
if (!string.IsNullOrWhiteSpace(_user_id))
request.AddQueryParameter("user_id", _user_id);

if (_custom != null)
{
foreach (KeyValuePair<string, string> kvp in _custom)
request.AddQueryParameter(kvp.Key, kvp.Value);
}

_filter?.Apply(request);
_marker?.Apply(request);
_reaction?.Apply(request);
Expand Down