/// <summary>
        /// Gets a list of up to 250 of the shop's products.
        /// </summary>
        /// <returns></returns>
        public async Task<IEnumerable<ShopifyProduct>> ListAsync(ShopifyProductFilterOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("products.json", Method.GET, "products");

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

            return await RequestEngine.ExecuteRequestAsync<List<ShopifyProduct>>(_RestClient, req);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a list of up to 250 of the shop's products.
        /// </summary>
        /// <returns></returns>
        public async Task <IEnumerable <ShopifyProduct> > ListAsync(ShopifyProductFilterOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("products.json", Method.GET, "products");

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

            return(await RequestEngine.ExecuteRequestAsync <List <ShopifyProduct> >(_RestClient, req));
        }
        /// <summary>
        /// Gets a count of all of the shop's products.
        /// </summary>
        /// <returns>The count of all products for the shop.</returns>
        public async Task<int> CountAsync(ShopifyProductFilterOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("products/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");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets a count of all of the shop's products.
        /// </summary>
        /// <returns>The count of all products for the shop.</returns>
        public async Task <int> CountAsync(ShopifyProductFilterOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("products/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"));
        }