private string GetFormattedArticlesUri(string resourceUrl, ArticleSortingOptions options, ArticleSideLoadOptionsEnum sideloadOptions) { if (options != null) { if (string.IsNullOrEmpty(options.Locale)) { throw new ArgumentException("Locale is required to sort"); } resourceUrl = options.GetSortingString(resourceUrl); } string sideLoads = sideloadOptions.ToString().ToLower().Replace(" ", ""); if (sideloadOptions != ArticleSideLoadOptionsEnum.None) { resourceUrl += resourceUrl.Contains("?") ? "&include=" : "?include="; //Categories flag REQUIRES sections to be added as well, or nothing will be returned if (sideloadOptions.HasFlag(ArticleSideLoadOptionsEnum.Categories) && !sideloadOptions.HasFlag(ArticleSideLoadOptionsEnum.Sections)) { sideLoads += string.Format(",{0}", ArticleSideLoadOptionsEnum.Sections.ToString().ToLower()); } resourceUrl += sideLoads; } return(resourceUrl); }
public GroupArticleResponse GetArticlesBySectionId(long sectionId, ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var uri = string.Format("help_center/sections/{0}/articles.json", sectionId); var resourceUrl = this.GetFormattedArticlesUri(uri, options, sideloadOptions); return GenericGet<GroupArticleResponse>(resourceUrl); }
public GroupArticleResponse GetArticlesBySectionId(long sectionId, ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var uri = string.Format("help_center/sections/{0}/articles.json", sectionId); var resourceUrl = this.GetFormattedArticlesUri(uri, options, sideloadOptions); return(GenericGet <GroupArticleResponse>(resourceUrl)); }
public GroupArticleResponse GetArticles(ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null, int?perPage = null, int?page = null) { var resourceUrl = this.GetFormattedArticlesUri("help_center/articles.json", options, sideloadOptions); return(GenericPagedGet <GroupArticleResponse>(resourceUrl, perPage, page)); }
public async Task <GroupArticleResponse> GetArticlesByCategoryIdAsync(long categoryId, ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var uri = string.Format("help_center/categories/{0}/articles.json", categoryId); var resourceUrl = this.GetFormattedArticlesUri(uri, options, sideloadOptions); return(await GenericGetAsync <GroupArticleResponse>(resourceUrl)); }
public GroupArticleResponse GetArticlesByCategoryId(long categoryId, ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var uri = $"{urlPrefix}/categories/{categoryId}/articles.json"; var resourceUrl = this.GetFormattedArticlesUri(uri, options, sideloadOptions); return(GenericGet <GroupArticleResponse>(resourceUrl)); }
public async Task <GroupArticleResponse> GetArticlesBySectionIdAsync(long sectionId, ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var uri = $"{urlPrefix}/sections/{sectionId}/articles.json"; var resourceUrl = this.GetFormattedArticlesUri(uri, options, sideloadOptions); return(await GenericGetAsync <GroupArticleResponse>(resourceUrl)); }
public async Task <GroupArticleResponse> GetArticlesAsync(ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null, int?perPage = null, int?page = null) { var resourceUrl = this.GetFormattedArticlesUri($"{urlPrefix}/articles.json", options, sideloadOptions); return(await GenericPagedGetAsync <GroupArticleResponse>(resourceUrl, perPage, page)); }
public GroupArticleResponse GetArticles(ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null, int? perPage = null, int? page = null) { var resourceUrl = this.GetFormattedArticlesUri("help_center/articles.json", options, sideloadOptions); return GenericPagedGet<GroupArticleResponse>(resourceUrl, perPage, page); }
private string GetFormattedArticlesUri(string resourceUrl, ArticleSortingOptions options, ArticleSideLoadOptionsEnum sideloadOptions) { if (options != null) { if (string.IsNullOrEmpty(options.Locale)) throw new ArgumentException("Locale is required to sort"); resourceUrl = options.GetSortingString(resourceUrl); } string sideLoads = sideloadOptions.ToString().ToLower().Replace(" ", ""); if (sideloadOptions != ArticleSideLoadOptionsEnum.None) { resourceUrl += resourceUrl.Contains("?") ? "&include=" : "?include="; //Categories flag REQUIRES sections to be added as well, or nothing will be returned if (sideloadOptions.HasFlag(ArticleSideLoadOptionsEnum.Categories) && !sideloadOptions.HasFlag(ArticleSideLoadOptionsEnum.Sections)) { sideLoads += string.Format(",{0}", ArticleSideLoadOptionsEnum.Sections.ToString().ToLower()); } resourceUrl += sideLoads; } return resourceUrl; }
public async Task<GroupArticleResponse> GetArticlesByCategoryIdAsync(long categoryId, ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var uri = string.Format("help_center/categories/{0}/articles.json", categoryId); var resourceUrl = this.GetFormattedArticlesUri(uri, options, sideloadOptions); return await GenericGetAsync<GroupArticleResponse>(resourceUrl); }
public async Task <GroupArticleResponse> GetArticlesAsync(ArticleSideLoadOptionsEnum sideloadOptions = ArticleSideLoadOptionsEnum.None, ArticleSortingOptions options = null) { var resourceUrl = this.GetFormattedArticlesUri("help_center/articles.json", options, sideloadOptions); return(await GenericGetAsync <GroupArticleResponse>(resourceUrl)); }