Ejemplo n.º 1
0
        /// <summary>
        /// Gets a list of up to 250 of the shop's pages.
        /// </summary>
        /// <returns></returns>
        public async Task<IEnumerable<ShopifyPage>> ListAsync(ShopifyPageFilterOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("pages.json", Method.GET, "pages");

            //Add optional parameters to request
            if (options != null) req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost));

            return await RequestEngine.ExecuteRequestAsync<List<ShopifyPage>>(_RestClient, req);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets a count of all of the shop's pages.
        /// </summary>
        /// <returns>The count of all pages for the shop.</returns>
        public async Task<int> CountAsync(ShopifyPageFilterOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("pages/count.json", Method.GET);

            //Add optional parameters to request
            if (options != null) req.Parameters.AddRange(options.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");
        }