diff --git a/PushbulletSharp/PushbulletClient.cs b/PushbulletSharp/PushbulletClient.cs index a0d6c13..2529901 100644 --- a/PushbulletSharp/PushbulletClient.cs +++ b/PushbulletSharp/PushbulletClient.cs @@ -788,15 +788,15 @@ public PushResponseContainer GetPushes(PushResponseFilter filter) } string queryString = string.Empty; + List queryStringList = new List(); - if(!string.IsNullOrWhiteSpace(filter.Cursor)) + if (!string.IsNullOrWhiteSpace(filter.Cursor)) { - queryString = string.Concat("?cursor=", filter.Cursor); + string cursorQueryString = string.Format("cursor={0}", filter.Cursor); + queryStringList.Add(cursorQueryString); } else { - List queryStringList = new List(); - if (filter.ModifiedDate != null) { string modifiedDateQueryString = string.Format("modified_after={0}", filter.ModifiedDate.DateTimeToUnixTime()); @@ -808,17 +808,19 @@ public PushResponseContainer GetPushes(PushResponseFilter filter) string activeQueryString = string.Format("active={0}", (bool)filter.Active); queryStringList.Add(activeQueryString); } + } - if(!string.IsNullOrWhiteSpace(filter.Email)) - { - string emailQueryString = string.Format("email={0}", filter.Email); - queryStringList.Add(emailQueryString); - } + //Email filtering can be done on either cursor or regular queries + if (!string.IsNullOrWhiteSpace(filter.Email)) + { + string emailQueryString = string.Format("email={0}", filter.Email); + queryStringList.Add(emailQueryString); + } - if (queryStringList.Count() > 0) - { - queryString = string.Concat("?", string.Join("&", queryStringList)); - } + //Join all of the query strings + if (queryStringList.Count() > 0) + { + queryString = string.Concat("?", string.Join("&", queryStringList)); } #endregion