Exemplo n.º 1
0
        /// <summary>
        /// Creates a new <see cref="ShopifySmartCollection"/>.
        /// </summary>
        /// <param name="collection">A new <see cref="ShopifySmartCollection"/>. Id should be set to null.</param>
        public async Task <ShopifySmartCollection> CreateAsync(ShopifySmartCollection collection)
        {
            var req = RequestEngine.CreateRequest($"smart_collections.json", Method.POST, "smart_collection");

            req.AddJsonBody(new { smart_collection = collection });

            return(await RequestEngine.ExecuteRequestAsync <ShopifySmartCollection>(_RestClient, req));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the given <see cref="ShopifySmartCollection"/>. Id must not be null.
        /// </summary>
        /// <param name="collection">The smart collection to update.</param>
        public virtual async Task <ShopifySmartCollection> UpdateAsync(ShopifySmartCollection collection)
        {
            var req = RequestEngine.CreateRequest($"smart_collections/{collection.Id.Value}.json", Method.PUT, "smart_collection");

            req.AddJsonBody(new { smart_collection = collection });

            return(await RequestEngine.ExecuteRequestAsync <ShopifySmartCollection>(_RestClient, req));
        }
        /// <summary>
        /// Updates the given <see cref="ShopifySmartCollection"/>. Id must not be null.
        /// </summary>
        /// <param name="collection">The smart collection to update.</param>
        public async Task<ShopifySmartCollection> UpdateAsync(ShopifySmartCollection collection)
        {
            var req = RequestEngine.CreateRequest($"smart_collections/{collection.Id.Value}.json", Method.PUT, "smart_collection");

            req.AddJsonBody(new { smart_collection = collection });

            return await RequestEngine.ExecuteRequestAsync<ShopifySmartCollection>(_RestClient, req);
        }