Skip to content

Commit 115f324

Browse files
authored
feat: add custom request parameters (#93)
1 parent e7fb89d commit 115f324

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Models/GetOptions.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Stream.Rest;
2+
using System.Collections.Generic;
23

34
namespace Stream.Models
45
{
@@ -17,6 +18,8 @@ public class GetOptions
1718
private string _feed_slug = null;
1819
private string _user_id = null;
1920

21+
private IDictionary<string, string> _custom = null;
22+
2023
public GetOptions WithOffset(int offset)
2124
{
2225
_offset = offset;
@@ -77,6 +80,17 @@ public GetOptions WithUserId(string userId)
7780
return this;
7881
}
7982

83+
public GetOptions WithCustom(string key, string value)
84+
{
85+
if (_custom == null)
86+
{
87+
_custom = new Dictionary<string, string>();
88+
}
89+
90+
_custom.Add(key, value);
91+
return this;
92+
}
93+
8094
internal void Apply(RestRequest request)
8195
{
8296
request.AddQueryParameter("offset", _offset.ToString());
@@ -97,6 +111,12 @@ internal void Apply(RestRequest request)
97111
if (!string.IsNullOrWhiteSpace(_user_id))
98112
request.AddQueryParameter("user_id", _user_id);
99113

114+
if (_custom != null)
115+
{
116+
foreach (KeyValuePair<string, string> kvp in _custom)
117+
request.AddQueryParameter(kvp.Key, kvp.Value);
118+
}
119+
100120
_filter?.Apply(request);
101121
_marker?.Apply(request);
102122
_reaction?.Apply(request);

0 commit comments

Comments
 (0)