/// <summary> /// Gets a count of the articles belonging to the given blog. /// </summary> /// <param name="blogId">The blog that the articles belong to.</param> /// <param name="filter">Options for filtering the result.</param> public async Task<int> CountAsync(long blogId, ShopifyPublishableCountFilter filter = null) { var req = RequestEngine.CreateRequest($"blogs/{blogId}/articles/count.json", Method.GET, "count"); if (filter != null) { req.Parameters.AddRange(filter.ToParameters(ParameterType.GetOrPost)); } return await RequestEngine.ExecuteRequestAsync<int>(_RestClient, req); }
/// <summary> /// Gets a count of all of the shop's ProductImages. /// </summary> /// <param name="productId">The id of the product that counted images belong to.</param> /// <param name="filter">An optional filter that restricts the results.</param> /// <returns>The count of all ProductImages for the shop.</returns> public async Task<int> CountAsync(long productId, ShopifyPublishableCountFilter filter = null) { var req = RequestEngine.CreateRequest($"products/{productId}/images/count.json", Method.GET); if (filter != null) { req.Parameters.AddRange(filter.ToParameters(ParameterType.GetOrPost)); } JToken responseObject = await RequestEngine.ExecuteRequestAsync(_RestClient, req); //Response looks like { "count" : 123 }. Does not warrant its own class. return responseObject.Value<int>("count"); }