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(ShopifyPageFilter 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(ShopifyPageFilter filter = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("pages/count.json", Method.GET);

            //Add optional parameters to request
            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");
        }