public async Task <DsqApiResponse <List <DsqPost> > > ThreadsListPostsAsync( string thread, string cursor = "", DsqLimit?limit = null, DsqIncludePost include = DsqIncludePost.Approved | DsqIncludePost.Unapproved | DsqIncludePost.Highlighted, DsqSortOrder order = DsqSortOrder.Newest, string forum = "", PostAttachments attach = PostAttachments.None, string query = "" ) { var arguments = new List <KeyValuePair <string, string> >() { { new KeyValuePair <string, string>("thread", thread) }, { new KeyValuePair <string, string>("limit", (limit ?? new DsqLimit(25)).ToString()) }, { new KeyValuePair <string, string>("order", order.ToArgument()) }, { new KeyValuePair <string, string>("cursor", cursor) }, }; foreach (var a in attach.GetFlags().Where(f => f.ToArgument() != "")) { if (attach.HasFlag(a)) { arguments.Add(new KeyValuePair <string, string>("attach", a.ToArgument())); } } foreach (var f in include.GetFlags()) { if (include.HasFlag(f)) { arguments.Add(new KeyValuePair <string, string>("include", f.ToArgument())); } } if (!String.IsNullOrWhiteSpace(forum)) { arguments.Add(new KeyValuePair <string, string>("forum", forum)); } if (!String.IsNullOrWhiteSpace(query)) { arguments.Add(new KeyValuePair <string, string>("query", query)); } return(await _factory.GetApiDataAsync <DsqApiResponse <List <DsqPost> > >(resource : "threads", endpoint : "listPosts", arguments : arguments)); }
public async Task <DsqApiResponse <List <DsqPost> > > PostsListChildrenAsync( string parentPost, string forum, DsqSortOrder order = DsqSortOrder.Oldest, DsqLimit?limit = null, bool includeForum = false, bool includeThread = false, DsqIncludePost include = DsqIncludePost.Approved | DsqIncludePost.Highlighted, PostAttachments attach = PostAttachments.None ) { var arguments = new List <KeyValuePair <string, string> >() { { new KeyValuePair <string, string>("parent_post", parentPost) }, { new KeyValuePair <string, string>("forum", forum) }, { new KeyValuePair <string, string>("limit", limit.ToString()) }, { new KeyValuePair <string, string>("order", order.ToArgument()) }, }; if (includeForum) { arguments.Add(new KeyValuePair <string, string>("related", "forum")); } if (includeThread) { arguments.Add(new KeyValuePair <string, string>("related", "thread")); } foreach (var a in attach.GetFlags().Where(f => f.ToArgument() != "")) { if (attach.HasFlag(a)) { arguments.Add(new KeyValuePair <string, string>("attach", a.ToArgument())); } } return(await _factory.GetApiDataAsync <DsqApiResponse <List <DsqPost> > >("posts", "list", arguments)); }